meta-smartwatch
meta-smartwatch copied to clipboard
[beluga] USB only working in ADB mode
It appears that on beluga only ADB mode is working.
Running systemctl status usb-moded.service gives this result:
x usb-moded.service - usb-moded USB gadget controller
Loaded: loaded (/lib/systemd/system/usb-moded.service; disabled; preset: disabled)
Active: failed (Result: exit-code) since Fri 2024-05-31 14:33:25 EDT; 50min ago
Process: 989 ExecStartPre=/usr/bin/init_ffs (code=exited, status=1/FAILURE)
May 31 14:33:25 beluga systemd[1]: usb-moded.service: Control process exi...LURE
May 31 14:33:25 beluga systemd[1]: usb-moded.service: Failed with result ...de'.
May 31 14:33:25 beluga systemd[1]: Failed to start usb-moded USB gadget c...ler.
May 31 14:33:25 beluga systemd[1]: usb-moded.service: Scheduled restart j...t 5.
May 31 14:33:25 beluga systemd[1]: Stopped usb-moded USB gadget controller.
May 31 14:33:25 beluga systemd[1]: usb-moded.service: Start request repea...kly.
May 31 14:33:25 beluga systemd[1]: usb-moded.service: Failed with result ...de'.
May 31 14:33:25 beluga systemd[1]: Failed to start usb-moded USB gadget c...ler.
Hint: Some lines were ellipsized, use -l to show in full.
Manually running /usr/bin/init_ffs gives this:
/usr/bin/init_ffs: line 3: can't create /sys/class/android_usb/android0/enable: Permission denied
/usr/bin/init_ffs: line 9: can't create /sys/class/android_usb/android0/iSerial: Permission denied
/usr/bin/init_ffs: line 10: can't create /sys/class/android_usb/android0/iManufacturer: Permission denied
/usr/bin/init_ffs: line 11: can't create /sys/class/android_usb/android0/iProduct: Permission denied
/usr/bin/init_ffs: line 13: can't create /sys/class/android_usb/android0/enable: Permission denied
That file is here:
#!/bin/sh
echo "0" > /sys/class/android_usb/android0/enable
manufacturer="$(cat /system/build.prop | grep -o 'ro.product.manufacturer=.*' | cut -d'=' -f 2)"
model="$(cat /system/build.prop | grep -o 'ro.product.model=.*' | cut -d'=' -f 2)"
serial="$(cat /proc/cmdline | sed 's/.*androidboot.serialno=//' | sed 's/ .*//')"
echo $serial > /sys/class/android_usb/android0/iSerial
echo $manufacturer > /sys/class/android_usb/android0/iManufacturer
echo $model > /sys/class/android_usb/android0/iProduct
echo "1" > /sys/class/android_usb/android0/enable
It appears that a driver that was supposed to create /sys/class/android_usb/android0/enable failed to load. This version claims to have a build id of 20231112200039, so I will build a fresh one from source and try that.
While this is true, and ADB is the only working mode, it's impossible to change USB mode in settings and even impossible to set it to charging only