Connecting to a Usb peripheral - android-things

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

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
On Raspberry Pi 3, the console needs to be disabled, see: UART peripherals on Android Things for Raspberry Pi 3

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.

As #devunwired commented in the Google's IoT Developers Community: USB accessory support is not currently enabled is the RC1 preview.

Related

Ellysis Bluetooth Sniffing Apple Airpods

I'm trying to determine how Apple Airpods pair and connect as seamlessly as they do, but I couldn't find any in-depth technical explanation so I embarked on a journey to figure it out for myself. I have used an Ellysis Explorer Bluetooth sniffer to sniff both BLE and Bluetooth Classic packets from the Airpods and the iPhone I have used to connect with it.
The issue is that I lack the background knowledge in Bluetooth to fully understand what I am looking at so I'm hoping somebody can explain what is appearing on the BT sniffer in the snapshots below:
The below picture is a list of the BLE packets captured after the Airpods case has been opened but BEFORE connecting to the phone.
The below picture is a list of the Bluetooth Classic packets captured after the Airpods case has been opened but BEFORE connecting to the phone.
The below picture is a list of the Bluetooth Classic packets AFTER connecting to the phone captured on top of the previous ones.
Note that there are no new BLE packets picked up after connecting.
The 1st pic shows that both ears are sending advertising packets.
Then one of the ear is paging the other ear and exchanging information.
Then the iPhone is connected to one of the ear just like normal A2DP connection.
More captures while audio is just started playing would be helpful.
Before analysing packets you need to learn about CoreBluetooth framework. CoreBluetooth deals with scanning, connecting and writing and reading data from "Bluetooth Low Energy" (BLE) devices. BLEs (Peripherals) continuously broadcast a small packet of data when they are not connected with any device Central.
First images shows data which is being broadcasted by BLE, in your case an airpod.

wlan card get all signals 2.4 ghz

I don't know if this is possible.
I bought a remote controlled car and now I want to send signals from my computer, rather than the remote control.
I'd like to send the signals with my wireless card (RC and WLAN Card are both 2.4 gHz). So the card needs to give me all traffic in the air. Not only WLAN signals.
Are there any wireless cards that can do that?
It doesn't matter if this is only possible on one OS.
First make sure that your remote controlled car supports WLAN interface because most of the remote controlled devices are working on either Infrared interface or Bluetooth.
If your remote controlled car supports WLAN interface then only you can send WLAN signal to your car using wireless card (RC and WLAN Card are both 2.4 gHz).
I will suggest you to check these thing first :)

Bluetooth transmitter that can receive commands from wi-fi network?

I am looking into building some apps for bluetooth accessories, and wanted to know if there was some sort of device that could do the following (for sake of simplicity, lets call the "wi-fi to bluetooth" transmitter the "dongle"):
Dongle can connect to a wi-fi network, mobile device then sends a command over wi-fi
Dongle receives command from wi-fi network
Dongle then converts those commands and transmits out as bluetooth
Bluetooth accessory then receives the converted commands from dongle
I am not sure if such a device exists, but I have some great ideas for building apps that could remotely access bluetooth accessories over a wi-fi network.

How does Linux kernel wifi driver determine when a connection is lost?

My understanding is that current WiFi driver uses rate control algorithm to choose a data rate within a small set of predetermined values to send packets over the WiFi medium. Different algorithms exist for this purpose. But how does this process work when WiFi driver decides that the connection is lost and shutdown the connection all together? Which part of the code should I read in open source WiFi driver such as MadWiFi and the likes?
The WiFi driver for your hardware which runs in Linux communicates with the WiFi chip which also runs a pretty complex firmware. The interface between the driver and the firmware is hardware specific. In some hardware the detection of connection loss events is done completely by the firmware and the driver only gets a "disconnected" event while in others the driver is also involved.
Regardless of who does what disconnection usually occurs due to either
Receiving a DEAUTH frame from the AP
Detecting too many missing beacons. Beacons are WiFi frames sent periodically by the AO (for most APs every ~100ms) . If you get too far from the AP or the AP was just powered off you stop seeing the beacons in the air and usually you'll signal disconnection or try to roam to a different AP.
Too many failures on Tx of packets (i.e. not receiving ACK frames for too much traffic)
This usually indicates that you've gone too far from the AP. It could be that you can "hear" the AP but it can't hear you already. In this case it also makes sense to signal a disconnection.
For example you can look in TI wifi driver in the Linux kernel drivers/net/wireless/ti/wlcore/events.c and the function wlcore_event_beacon_loss()
In Cfg80211 architecture, assume we are station mode.
driver call kernel API cfg80211_send_disassoc() if we received a deassoc/deauth frame.this function will notify corresponding application (ex wpa_supplicant) a disconnect event.
on another hand, when we decide to disconnect with AP, applicantion (ex wpa_supplicant) can call linux kernel API cfg80211_disconnected(), it will trigger corresponding driver ioctl function to finish disconnection task.

Communication between ZigBee and Bluetooth

Bluetooth and ZigBee devices are working or pairing within its own family devices based on parameters such as network layers, security algorithms, etc... I want to write an application to make a communication between ZigBee and Bluetooth device. Is it possible?
You would need to create a gateway between the two networks. Your application would need to interface with a ZigBee radio and a Bluetooth radio, join each network, and then proxy communications between devices on the networks.
What devices do you plan to bridge? Your application will need to appear as device X on the ZigBee network, and device Y on the Bluetooth network and convert data received to the correct format to send out on the other network.
If it were kept simple, something like this could work. A module that is a Zigbee presence, with a pairable bluetooth node. If a bluetooth-paired device comes near, the Zigbee announces itself as 'present'. When the bluuue tooth paired device is no longer around, the Zigbee device becomes "not present".

Resources