Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Connecting to a Usb peripheral

It looks like the UsbManager is gone in the build. How do we communicate with usb peripherals now?

Things like usb->serial etc using https://github.com/mik3y/usb-serial-for-android

like image 377
annymsMthd Avatar asked Dec 14 '16 20:12

annymsMthd


People also ask

What is a USB peripheral?

Universal Serial Bus (USB) is a way to connect peripheral devices to computers. It replaces the functionality of serial and parallel ports, including keyboard and mouse ports. USB uses a bus topology, which means peripherals can be daisy-chained together or connected through hubs.


2 Answers

Currently the Peripheral HAL doesn't recognize usbserial based UART peripherals.

But if your usbserial device (ex: Arduino) exposes individual UART TX RX pins, you can communicate with it using the UART Peripheral API.

Caveat:

  • Don't forget to cross TX and RX when connecting the peripheral to the UART board of your development board uart-cross
  • On Raspberry Pi 3, the console needs to be disabled, see: UART peripherals on Android Things for Raspberry Pi 3
like image 148
proppy Avatar answered Nov 12 '22 10:11

proppy


It is stated on the known issues part of the release notes that USB support is disabled on the developer preview 1.

However I did a quick test on the Pi3 and high level peripherals such a keyboard work and send the correct events to the app. It is just the low level access what is disabled.

like image 35
shalafi Avatar answered Nov 12 '22 12:11

shalafi