From 10ff83215b154797d511dd8498878cdfd8bf7f5a Mon Sep 17 00:00:00 2001 From: Joe Da Silva Date: Wed, 9 Aug 2023 13:31:14 -0700 Subject: [PATCH] add LABEL="adb_mode" for the different possible modes available As new devices are added we can see 51-android.rules is growing in size. To help reduce code and also compress 51-android.rules we add GOTO LABELs at the bottom to set some needed variables. --- 51-android.rules | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/51-android.rules b/51-android.rules index 98441d2..51f7f42 100644 --- a/51-android.rules +++ b/51-android.rules @@ -871,15 +871,40 @@ ATTR{idVendor}=="2b4c", ENV{adb_user}="yes" # Verifone ATTR{idVendor}=="11ca", ENV{adb_user}="yes" -# Skip other vendor tests -LABEL="android_usb_rule_match" +# Skip past LABEL=found_env,set_env +GOTO="android_usb_rule_match" + +# ADB Debug User (default) +LABEL="go_adb" +ENV{adb_adb}="yes", GOTO="android_usb_rule_match" + +# ADB Debug and Fastboot mode +LABEL="go_adbfast" +ENV{adb_adbfast}="yes", GOTO="android_usb_rule_match" + +# ADB Debug and MTP mode +LABEL="go_adbmtp" +ENV{adb_adbmtp}="yes", GOTO="android_usb_rule_match" + +# ADB Debug and PTP mode +LABEL="go_adbptp" +ENV{adb_adbptp}="yes", GOTO="android_usb_rule_match" + +# ADB Debug and MIDI mode +LABEL="go_adbmidi" +ENV{adb_adbmidi}="yes", GOTO="android_usb_rule_match" + +# ADB Debug and Tether mode +LABEL="go_adbrndis" +ENV{adb_adbrndis}="yes", GOTO="android_usb_rule_match" # Symlink shortcuts to reduce code in tests above +LABEL="android_usb_rule_match" ENV{adb_adbfast}=="yes", ENV{adb_adb}="yes", ENV{adb_fast}="yes" ENV{adb_adbmtp}=="yes", ENV{adb_adb}="yes", SYMLINK+="libmtp-%k", ENV{ID_MTP_DEVICE}="1", ENV{ID_MEDIA_PLAYER}="1" ENV{adb_adbptp}=="yes", ENV{adb_adb}="yes" ENV{adb_adbtet}=="yes", ENV{adb_adb}="yes" -ENV{adb_adbmidi}=="yes", ENV{adb_adb}="yes", SYMLINK+="midi", SYMLINK+="midi0%n" +ENV{adb_adbmidi}=="yes", ENV{adb_adb}="yes", SYMLINK+="android_midi", SYMLINK+="android_midi0%n" ENV{adb_adb}=="yes", ENV{adb_user}="yes", SYMLINK+="android_adb" ENV{adb_fast}=="yes", SYMLINK+="android_fastboot"