mirror of
https://github.com/NixOS/mobile-nixos.git
synced 2024-11-28 04:14:57 +03:00
initrd-usb: Fixes for adbd on asus-z00t
The gist of it: * The "adb" function is not available (-22, EINVAL) on asus-z00t * Enabling both adb and ffs breaks asus-flo * Enabling ffs is fine with asus-flo. So I guess it's ffs that enables adb!
This commit is contained in:
parent
7b1d782893
commit
c498dc1b38
@ -5,6 +5,8 @@ with import ./initrd-order.nix;
|
||||
|
||||
let
|
||||
cfg = config.mobile.boot.stage-1;
|
||||
device_name = device_config.name;
|
||||
device_config = config.mobile.device;
|
||||
system_type = config.mobile.system.type;
|
||||
in
|
||||
{
|
||||
@ -37,29 +39,30 @@ in
|
||||
config.mobile.boot.stage-1 = lib.mkIf cfg.usb.enable {
|
||||
usb.features = []
|
||||
++ optional cfg.networking.enable "rndis"
|
||||
++ optional cfg.usb.adbd "adb"
|
||||
++ optional cfg.usb.adbd "ffs"
|
||||
;
|
||||
|
||||
# TODO: Only run, when we have the android usb driver
|
||||
init = lib.mkOrder AFTER_DEVICE_INIT ''
|
||||
# Setting up Android-specific USB.
|
||||
(
|
||||
SYS=/sys/class/android_usb/android0
|
||||
if [ -e "$SYS" ]; then
|
||||
mkdir /dev/usb-ffs/adb
|
||||
mkdir -p /dev/usb-ffs/adb
|
||||
mount -t functionfs adb /dev/usb-ffs/adb/
|
||||
|
||||
printf "%s" "0" > "$SYS/enable"
|
||||
printf "%s" "18D1" > "$SYS/idVendor"
|
||||
printf "%s" "D001" > "$SYS/idProduct"
|
||||
printf "%s" "0" > "$SYS/bDeviceClass"
|
||||
#printf "%s" "adb" > "$SYS/f_ffs/aliases"
|
||||
#printf "%s" "${concatStringsSep "," cfg.usb.features}" > "$SYS/functions"
|
||||
printf "%s" "rndis,adb" > "$SYS/functions"
|
||||
printf "%s" "FIXME" > "$SYS/iManufacturer"
|
||||
printf "%s" "FIXME" > "$SYS/iProduct"
|
||||
printf "%s" "FIXME" > "$SYS/iSerial"
|
||||
sleep 0.5
|
||||
printf "%s" "${concatStringsSep "," cfg.usb.features}" > "$SYS/functions"
|
||||
printf "%s" "mobile-nixos" > "$SYS/iManufacturer"
|
||||
printf "%s" "${device_name}" > "$SYS/iProduct"
|
||||
printf "%s" "0123456789" > "$SYS/iSerial"
|
||||
|
||||
sleep 0.1
|
||||
printf "%s" "1" > "$SYS/enable"
|
||||
sleep 1
|
||||
sleep 0.1
|
||||
|
||||
${optionalString cfg.usb.adbd "adbd &\n"}
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user