mirror of
https://github.com/NixOS/mobile-nixos.git
synced 2024-11-24 12:42:47 +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
|
let
|
||||||
cfg = config.mobile.boot.stage-1;
|
cfg = config.mobile.boot.stage-1;
|
||||||
|
device_name = device_config.name;
|
||||||
|
device_config = config.mobile.device;
|
||||||
system_type = config.mobile.system.type;
|
system_type = config.mobile.system.type;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
@ -37,29 +39,30 @@ in
|
|||||||
config.mobile.boot.stage-1 = lib.mkIf cfg.usb.enable {
|
config.mobile.boot.stage-1 = lib.mkIf cfg.usb.enable {
|
||||||
usb.features = []
|
usb.features = []
|
||||||
++ optional cfg.networking.enable "rndis"
|
++ 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
|
# TODO: Only run, when we have the android usb driver
|
||||||
init = lib.mkOrder AFTER_DEVICE_INIT ''
|
init = lib.mkOrder AFTER_DEVICE_INIT ''
|
||||||
# Setting up Android-specific USB.
|
# Setting up Android-specific USB.
|
||||||
(
|
(
|
||||||
SYS=/sys/class/android_usb/android0
|
SYS=/sys/class/android_usb/android0
|
||||||
if [ -e "$SYS" ]; then
|
if [ -e "$SYS" ]; then
|
||||||
mkdir /dev/usb-ffs/adb
|
mkdir -p /dev/usb-ffs/adb
|
||||||
mount -t functionfs adb /dev/usb-ffs/adb/
|
mount -t functionfs adb /dev/usb-ffs/adb/
|
||||||
|
|
||||||
printf "%s" "0" > "$SYS/enable"
|
printf "%s" "0" > "$SYS/enable"
|
||||||
printf "%s" "18D1" > "$SYS/idVendor"
|
printf "%s" "18D1" > "$SYS/idVendor"
|
||||||
printf "%s" "D001" > "$SYS/idProduct"
|
printf "%s" "D001" > "$SYS/idProduct"
|
||||||
printf "%s" "0" > "$SYS/bDeviceClass"
|
printf "%s" "0" > "$SYS/bDeviceClass"
|
||||||
#printf "%s" "adb" > "$SYS/f_ffs/aliases"
|
printf "%s" "${concatStringsSep "," cfg.usb.features}" > "$SYS/functions"
|
||||||
#printf "%s" "${concatStringsSep "," cfg.usb.features}" > "$SYS/functions"
|
printf "%s" "mobile-nixos" > "$SYS/iManufacturer"
|
||||||
printf "%s" "rndis,adb" > "$SYS/functions"
|
printf "%s" "${device_name}" > "$SYS/iProduct"
|
||||||
printf "%s" "FIXME" > "$SYS/iManufacturer"
|
printf "%s" "0123456789" > "$SYS/iSerial"
|
||||||
printf "%s" "FIXME" > "$SYS/iProduct"
|
|
||||||
printf "%s" "FIXME" > "$SYS/iSerial"
|
sleep 0.1
|
||||||
sleep 0.5
|
|
||||||
printf "%s" "1" > "$SYS/enable"
|
printf "%s" "1" > "$SYS/enable"
|
||||||
sleep 1
|
sleep 0.1
|
||||||
|
|
||||||
${optionalString cfg.usb.adbd "adbd &\n"}
|
${optionalString cfg.usb.adbd "adbd &\n"}
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user