Control beaglebone black (linux) with android smartphone through usb cable - android

I have a beaglebone-black/raspberry-pi that is running a basic command line linux system. I am currently operating the board with a keyboard (usb) an an lcd screen (hdmi). Now I want to control the board with my android smartphone through a usb cable instead of keyboard and screen.
Example. There is an application on my android phone say Linux Terminal. That application sends command strings to the terminal running on board, receives the output and displays it.
I can develop android applications and I am also very fluent with C and linux but I am not very good with interfaces (usb) and drivers etc. I have never used a driver in programming.
I wanted to ask is it even possible. If so, is there any existing tool that can do this. If no such tool exists , then give me a brief outline of the whole process (which drivers to use etc).

I think this is what you are looking for:
Termius
JuiceSSH or
Connectbot
There is also a documentation for Termius:
https://www.raspberrypi.org/documentation/remote-access/ssh/android.md
Best regards,
Ben

Related

Access Android Emulator Storage via Windows File System

I am trying to develop a file communication system that interfaces between the respective file systems of a Windows PC and a connected Android device. I realize a better (or at least simpler) way to do this would probably involve using the adb push and pull commands, but I am gathering options/trying to avoid developing additional communications on the Windows side beyond its basic OS file access. I know it is possible to interact with the device's storage directly from Windows when the device is physically connected via USB - if I understand correctly, this is commonly done using MTP? However, I am also currently constrained to only being able to use an emulated Android device. The Android Emulator is a useful tool for a variety of development situations, but I am not sure it was ever intended to appear as an MTP device in Windows like its physical counterparts do.
So could anyone provide documentation or some other resource establishing either
an MTP, UMS, etc. Windows connection is indeed not possible with the default QEMU Android Emulator; or
it is, and how.
Judging by the answer provided here - https://stackoverflow.com/a/21633596/1399272 - it does not appear that accessing the Android file system using a mounted drive in the Windows file system is an option, regardless of whether it is emulated or physically connected. So my question becomes moot point.

Android: How to run/debug/test android app on tab?

I'm a novice in android app development (using Android Studio) and want to make an app and all set for go on but I have an issue and that is how can I run my app on my tab for test purpose as you know android emulator is slow (very slow). I had checked some answer but all are for window specific and I have Linux operating system.
I have a tablet (not rooted).
Usb cable.
wifi connection.
I need a way where I don't have to root my tablet and work on Linux too.
Thank you in advance
When you insert the cable of the tablet, linux should recognize it, if is not recognized you may install a driver.You can run the command:
$ lsusb
After that when appears the screen after you press run in AS, just select the device instead of the emulator.
If does not work, it could be that your tablet in development options ( psychically you have to interact with your tablet) does not have checked the option debug( on default is not activated), on some devices you have to look in the internet how to access to this option.
A last recommendation is to check in the manifest and in the build.gradle( take care there are two of them) that debbugable is set as true

In Android USB debugging mode, can I make my computer keyboard as input device to my mobile handset while USB debugging?

I like USB debugging on Android as it is faster than Emulator. I know I can use my keyboard in emulator but while debugging I want to use my computer keyboard (plugged to computer) instead of devices keyboard for making my input more faster. Is that possible?
Share KM is a free app that lets you use your PC's keyboard and mouse to control your Android. Connection can be made over USB, WiFi, or Bluetooth.
It works a lot like adding an additional monitor to your computer – move your mouse to the edge of your screen and the cursor moves to the Android.
I found a possibility via "adb tools". Connect your phone to the computer via usb cable and start adb at the computer terminal (e.g. Ubuntu)
adb shell input keyboard text Hello
or
adb shell input [<source>] <command> [<arg>...]
This will give you the possibility to send text/keystrokes via computer/laptop keyboard to your smartphone.
Note: your input will be sent through two shells (computer and android device), so you'd have to "double escape" even spaces. To avoid that, you may e.g. type
adb shell
input keyboard 'any text you like, including shell-sensitive characters'
the second line is input on your android device in adb shell
Tested on Ubuntu 14.04 LTS and Samsung Galaxy S3 with CyanogenMod.
Confirmed on Ubuntu 18.04 LTS and Moto G2 with Lineage OS
It sounds like you want to use your PC's keyboard via some software on the PC rather than use a separate USB keyboard connected to the Android device.
This actually is possible, but the details are device specific. You would need to send key events via adb, but you'd need to determine the implementation-specific translation of characters to event codes, and even the event channel number. There are likely open source projects out there for doing this, and you'd be better off starting with one of those than trying to develop it from scratch.
As for using a separate USB keyboard, as mentioned in comments this is a possibility on some more recent devices (typically you need an adapter cable with the ID pin grounded) but introduces the issue of not being able to use USB for ADB as well as a keyboard at the same time. One possible workaround would be to put ADB into TCP/wireless mode, unplug the computer and plug in the keyboard. A simpler approach could be to use a bluetooth keyboard.
Note that either the USB or bluetooth keyboard, and likely also the key event method, will cause the on-screen keyboard to pop up. People trying to use devices with external keyboards find this annoying and tend to install zero-height on screen keyboards; however, if you are testing what an actual user will do, then having the keyboard pop up will give a more realistic impression of the end-user experience (though of course the amount of screen real estate left after the keyboard varies from device to device).
Plug your keyboard directly into Android USB OTG port and it will work. Most of recent Android devices do support USB host mode apart very few models that have this feature intentionally removed (Google). There is also a good our guestion about this.
With my Google Galaxy Nexus and Lenovo tablet, even mouse works (mouse pointer appears). You probably can use USB switch that allows to share the keyboard between two computers. Mind also that you need USB OTG and not USB device converter (there are some USB converters that fit into micro USB OTG port nicely but are for USB devices only).
Of course, ADB cannot use the USB port if it is already taken by the keyboard. Hence you need to use wireless for ADB.
This proposal does not match fully your initial idea but seems matching the goal you are aiming to achieve (debug Android app directly on device using your keyboard).

Android OS hiding full USB tree

Is there a way of discovering the full USB tree from within an Android Application? The current USB Host API only provides a list of all the devices and their endpoints. I need to be able to associate the device with a particular port on the USB hub. In Windows I can see what port number each devices is on.
It appears that the Android OS masks the hub from view.
I thought about trying to access Linux through JNI, however, the app at the commentary at:
https://github.com/alt236/USB-Device-Info---Android, suggests that it doesn't appear in Linux too.
Any thoughts?
Thanks.
You can just walk the hardware tree. For instance, on my Nook it's /sys/devices/platform/musb_hdrc/usb1. Here's a screenshot of my app.

Android USB HID Device

Does anyone know how to configure an Android device (tablet) to appear as a USB HID device when connected to a PC?
Is there any other way of getting data from the tablet to the PC (via USB) other than writing it to a file, and have the PC retrieve the (updated) file from the tablet which is acting as a 'mass storage device' for the PC?
Can USB carry a TCP/IP end-end connection?
Using a tablet as a high-end intelligent 'keyboard' or 'mouse' or similar device would be immensely powerful, and open up lots of possibilities. Controlling a model railway layout is the end I have in mind.
Thanks
It's possible to do this using the linux gadget framework http://www.linux-usb.org/gadget/ using a custom composite USB device. The gadget framework is part of the Android kernel source tree by inheritance from Linux.
Unfortunately, Android has its own customizations that restrict the ability to dynamically register new USB gadgets so you will need to patch the kernel source tree for your particular device and add your HID gadget (otherwise you could create a module and load it that way) to the supported Android list.
I have done this before and will update this answer to contain more detail if there is interest. Unfortunately I lost the code so I will have to start from scratch.
If I set up a web server on my phone and enable usb tethering, I can access that server from my PC. If that's not enough for you, this might help: https://market.android.com/details?id=usbwebcam.application&hl=en
I'm running cyanogenmod on a Desire CDMA (BravoC)
Let me know what you find out; it would be pretty handy to use my phone as a USB keyboard in the field. An android server with a PC client is gonna be easiest though.
Have a look at Android Open Accessory Protocol 2.0. This could help you out.

Categories

Resources