-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Termux USB OTG support #1145
Comments
I've managed to read from an arduino but it required root to change the ownership of /dev/ACM0. There has been some previous related discussion here: #220 |
Any solution for usb-serial on Android since then? |
@yerpj Root is needed for usb serial. |
I have root! LineageOS 15.1. But when I connect any usb-to-serial adapter (FTDI, Prolific) I got no device in /dev (ACM* USB*). but de.kai_morich.serial_bluetooth_terminal (for exmaple) works |
Why it should be ? Your kernel has a driver for such devices ?
Likely userspace driver implementation. Android usb API allows that. But device /dev/* won't appear anyway. |
Really I mean that "root is insufficient for usb serial", but I agree that it's required. |
Anyway, cat termux implement usb-serial drivers in userspace? |
That's possible maybe, I even seen implementation somewhere on Github. |
Hi! Anyone knows if this may grant permissions in accessing OTG devices including serial ports to Termux environment? |
No. It won't grant filesystem-level permission to /dev/*. Driver can be implemented at API level. Example: kai-morich/usb-serial-for-android. |
Quite interested in this topic. I checked the tutorial about connecting arduino and Apps through OTG using java library. However, It could be even cooler if termux can talk directly to arduino. |
Let's consider USB OTG access on an unrooted Android. There seems to be an agreement that there are no serial over USB kernel drivers available on a stock Android. There are the following ways to access serial over USB:
Here is a native libusb based serial over USB library which we may adopt. For termux, I would like the 2nd solution. Ideally we would have a generic libusb support in Termux or Termux:API, which would help a native application to enumerate and open a USB device, negotiate access and pass an open file descriptor back to the native application. This would be the most performant solution, as the native application would talk directly to the kernel USB driver. It seems like there is a way to pass an open file descriptor from Termux::API to the native application using Binder. Also in Linux it is possible to pass open file descriptors using Unix sockets, but I am not sure whether that works on a stock Android linux kernel. Termux has a potential to become an "Arduino" for Android development, if we can get access to at least USB serial ports, better to bluetooth serial and all USB devices through libusb. It would be great to be able to sketch an application on Linux and then to transfer the application to Termux with minimum changes (compile time switch to open the serial port differently). This way one would be able to prototype a solution and maybe deploy it to a handful of customers before diving into Android development. Also a Sixel support would help termux/termux-app#142 :-) |
What if https://github.com/mik3y/usb-serial-for-android + https://github.com/hunterli/remserial |
I would warn against the first project - the Java implementation of the USB
OTG drivers. I believe this is what
https://play.google.com/store/apps/details?id=ro.yo3ggx.btvna&hl=en uses
and it is about 5x slower than an equivalent bluetooth link (with native
bluetooth drivers of Android).
…On Fri, Aug 9, 2019 at 12:46 PM Andrii Podanenko ***@***.***> wrote:
What if https://github.com/mik3y/usb-serial-for-android +
https://github.com/hunterli/remserial
The idea is to create sock file that will behave like a serial port.
Localhost loop
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1145?email_source=notifications&email_token=ABMPSI7GDENM46MKJXWBVBTQDVDHLA5CNFSM4DTHMKHKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD36KHTI#issuecomment-519873485>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABMPSI3GNC4ZFORIN6R6JHDQDVDHLANCNFSM4DTHMKHA>
.
|
My 5 cents... Why just not to add one more console utility which will use this one: https://github.com/felHR85/UsbSerial ? It's pretty complete and I saw no visible performance issues. |
once access to USB ports on non rooted devices is resolved we'll open whole bunch of home automation stuff like zigbee2mqtt nodejs app, openhub, etc |
I am trying PlatformIO on termux right now which runs fine and offers a big palette of sdks and frameworks, arduino, stm32...getting a black magic probe on usb to work would be a dream come true |
Basic usb support is implemented via API & specially patched |
@StephanBeer Are you able to upload the code to arduino using the Termux-usb api and platformio? |
@shubhampaul Android usually does not come with USB over serial kernel drivers, you have to implement the USB serial protocol in user space. You need to extend the work by @xeffyr with something like https://github.com/hutorny/usbuart |
Have a look at "Serial USB Terminal" in the play store (and the referenced code.) I use a serial term on a d1minir2 running my lua code. This d1mini uses a ch340 uart chip. It works fabuously. I need to give the dev a few $$. It is not an ide and does not support adding custom behaviours AFAIK. |
I'm not sure this issue should remain closed. The real issue (outside the title) is to use an Arduino with Termux. This would be huge!!!! Esp for something like octoprint running inside termux. Can someone get it going? |
@nival999 USB functionality is already implemented. Not in way suitable for most people, but we can't offer something else at this time. https://wiki.termux.com/wiki/Termux-usb If you have any suggestions how |
I would like to use termux with ubuntu to use octoprint with serial connection |
This is great, thanks a lot. I sketched up a server for streaming audio and commands to/from a HAM radio SDR transceiver. It works nicely. However, the termux-usb tool is a bit inconvenient. It would be great, if the termux-usb tool optionally accepted some form of USB device identification, for example VID/PID pair and/or the readable device description. Also I am having issues with TermuxAPI in general. For some unknown reason to me, it takes couple of tries and possibly couple of minutes before the termux API command line tools work. For example, the first call to termux-info hangs for a veeery long time and I often lose my patience with termux-usb -l, which hangs on me seemingly indefinitely. Once it starts working, the termux-api tools work reasonably quickly. I think I have #3809 |
We are trying to connect an Arduino via USB host to termux to read out serial data without success. Serial input is working to any Android Serial Monitor but cannot be used on termux / node red.
It seems that the Android Open Accessory Protocol 2.0 is not (or not fully) supportet ?!? Or maybe there is another reason?
While there are no other physical connections to android devices, USB support is very important, specially with node red. Any support is very welcome!
BR Eckehard
The text was updated successfully, but these errors were encountered: