APP support for USB modems

I found meshtastic from the idea of creating a similar system with a directly connected modem.

Is there any interest in supporting Usb modems directly like the LoraStik?

The android phone already has a display, buttons, gps. All you need is the Lora modem.

1 Like

I’m definitely interested in this, but it’s very difficult (and unlikely to come to fruition) to do this on Android.

The Android model for USB device support is so unlike anything else that even getting basic stuff (like interfacing with a normal Meshtastic node over USB) is incredibly challenging. Normally, on Linux, you’d use a kernel mode Linux driver – probably one of the built-in ones like ch341 or cp210x, stacked on top of usbserial – to communicate with T-Beam (or LoStik). Android has neither ch341 nor cp210x nor any of the “normal” USB drivers used for stuff like this. The things supported out-of-the-box are things like USB audio, USB HID (keyboard/mouse), and USB mass storage (flash drives, portable HDDs).

Stuff like USB printers, or serial ports, etc. don’t have any support on Android, which is what’s needed for such a project; implementing support for T-Beams, T-Echos, RAK, LoStik, etc. would require re-implementing the corresponding USB drivers (e.g. for USB serial), but in user mode, using the Android API for USB Host.

I actually don’t think the drivers are a big problem. I have already tested the LoraStik with the Andriod stock libraries and this library and was able to get a deviceID and do some basic terminal commands.

We “just” need to wrap the driver in a service and implement all the meshtastic comms locally instead of on the device like the app is expecting.

I will probably fork the android code this winter and start on integration however i am only a intermediate programmer and progress could be slow.

Oh, that makes it a lot easier. Yes, if someone has already written the appropriate USB-UART drivers for Android, that helps a lot.

Your best bet is probably to take a look at the Meshtastic Portduino target, and adding the code to that, and implementing the hooks needed (PortduinoGlue, LinuxGPIO?) in there to use the Android USB-UART library.

For the Android app, it currently only supports BLE as the transport for Protobuf. You could probably add a socket-based transport fairly easily, which would be reusable for WiFi-enabled targets, and enable support for the Meshtastic Portduino app to listen on a TCP port fairly easily.