Openstick: Updates for 10 Aug 2022

Linux Kernel

I had a Look at the Linux config file that was used by HandsomeHacker to compile the kernel. Other than the standard stuff that is needed, I see a few interesting things listed. Bluetooth, I2C and SPI (bitbang) are compiled in. So is HID with keyboard, mouse, etc.

Some oddballs are compiled in, considering that this is an LTE dongle, and not a phone: touchscreen, camera and sound.

Of interest are USB_GADGET and USB_CONFIGFS. CONFIGFS has the following options: SERIAL, ACM, OBEX, NCM, ECM, ECM_SUBSET, RNDIS, EEM, MASS_STOREAGE, F_LB_SS, F_UAC1, F_UAC1_LEGACY, F_UAC2, F_MIDI, F_HID, F_UVC, F_PRINTER, FS.

There is only one USB Gadget defined, which is RNDIS used by the usb0 port to give us Ethernet over USB. It should be possible to configure a composite gadget device that gives us Ethernet, serial and mass storage, all at once.

Others of interest are KEYBOARD_GPIO, which is used for individual buttons; GPIO, which may let us reassign some functions to the signal pads on the circuit board; LEDS_QCOM_LPG which may let us change what the LEDs are used for.

Using GPIO (probably via Device Tree), we may be able to assign I2C and/or SPI to the SIM card socket. I'm certain that the SIM card socket can be reassigned to be a serial port. Since this circuit board doesn't bring out very many signals to accessable pads, we are limited in what hardware we can make use of at one time.

Bluetooth

I wanted to see if Bluetooth worked, so I installed the Bluez Bluetooth Manager.

sudo apt-get install bluez*

I got some errors, but after using --fix-missing, things seemed to be OK. I enabled the bluetooth service, then started it.

systemctl enable bluetooth
systemctl start bluetooth

I did not see a Bluetooth device on my phone, as I expected. Checking things with systemctl status bluetooth, tells me that a kernel module bnep-protocol was missing. According to the kernel config, it should be compiled in. More investigation needed.

USB Host Mode

As documented by HandsomeHacker, you can switch from the default USB Device Mode to Host Mode by issuing the following command:

echo host > /sys/kernel/debug/usb/ci_hdrc.0/role

He doesn't tell you how to switch back:

echo gadget > /sys/kernel/debug/usb/ci_hdrc.0/role

As HandsomeHacker shows on his blog, when switched to Host mode, he was able to use a USB keyboard, mouse and flash drive, using an adapter he made. When the LTE dongle is in Host mode, you have to provide power and additional USB sockets for the other devices. I have some USB sockets on order, so I can build an adapter.