Set *Restrict USB* > *Deny USB connections*/*Allow USB connections when unlocked* with adb #22

Open
opened 2024-12-14 16:48:00 +01:00 by Benjamin_Loison · 7 comments
Related to [Benjamin-Loison/android/issues/](https://github.com/Benjamin-Loison/android/issues){[139](https://github.com/Benjamin-Loison/android/issues/139),[140](https://github.com/Benjamin-Loison/android/issues/140)}. +24
Benjamin_Loison changed title from Set *Restrict USB* > *Deny USB connections* with `adb` to Set *Restrict USB* > *Deny USB connections*/*Allow USB connections when unlocked* with `adb` 2024-12-31 00:39:46 +01:00
Author
Owner

DuckDuckGo and Google search "adb" "Restrict USB" first page of results does not seem to help.

DuckDuckGo and Google search `"adb" "Restrict USB"` first page of results does not seem to help.
Author
Owner
Related to [Benjamin_Loison/Voice_assistant/issues/18#issuecomment-4414577](https://codeberg.org/Benjamin_Loison/Voice_assistant/issues/18#issuecomment-4414577).
Author
Owner
Bash script:
for section in global system secure
do
    echo $section
    adb shell settings list $section | grep -iE 'restr|usb'
done
Output:
global
default_restrict_background_data=0
restricted_networking_mode=1
uids_allowed_on_restricted_networks=
usb_mass_storage_enabled=1
system
volume_music_usb_headset=3
volume_voice_usb_headset=15
secure
usb_audio_automatic_routing_disabled=0
<details> <summary>Bash script:</summary> ```bash for section in global system secure do echo $section adb shell settings list $section | grep -iE 'restr|usb' done ``` </details> <details> <summary>Output:</summary> ``` global default_restrict_background_data=0 restricted_networking_mode=1 uids_allowed_on_restricted_networks= usb_mass_storage_enabled=1 system volume_music_usb_headset=3 volume_voice_usb_headset=15 secure usb_audio_automatic_routing_disabled=0 ``` </details>
Author
Owner

No matter Restrict USB I face usb_mass_storage_enabled=1.

No matter *Restrict USB* I face `usb_mass_storage_enabled=1`.
Author
Owner
adb shell getprop | grep -E 'restr|usb'
Output:
[init.svc.usbd]: [stopped]
[persist.sys.usb.config]: []
[ro.boot.usbcontroller]: [a600000.dwc3]
[sys.usb.adb.disabled]: [0]
[sys.usb.configfs]: [2]
[sys.usb.controller]: [a600000.dwc3]
[sys.usb.mtp.batchcancel]: [1]
[sys.usb.mtp.device_type]: [3]
```bash adb shell getprop | grep -E 'restr|usb' ``` <details> <summary>Output:</summary> ``` [init.svc.usbd]: [stopped] [persist.sys.usb.config]: [] [ro.boot.usbcontroller]: [a600000.dwc3] [sys.usb.adb.disabled]: [0] [sys.usb.configfs]: [2] [sys.usb.controller]: [a600000.dwc3] [sys.usb.mtp.batchcancel]: [1] [sys.usb.mtp.device_type]: [3] ``` </details>
Author
Owner
adb shell getprop | grep 'usb'
Output:
[init.svc.usbd]: [stopped]
[persist.sys.usb.config]: []
[ro.boot.usbcontroller]: [a600000.dwc3]
[sys.usb.adb.disabled]: [0]
[sys.usb.configfs]: [2]
[sys.usb.controller]: [a600000.dwc3]
[sys.usb.mtp.batchcancel]: [1]
[sys.usb.mtp.device_type]: [3]

does not help experimentally.

```bash adb shell getprop | grep 'usb' ``` <details> <summary>Output:</summary> ``` [init.svc.usbd]: [stopped] [persist.sys.usb.config]: [] [ro.boot.usbcontroller]: [a600000.dwc3] [sys.usb.adb.disabled]: [0] [sys.usb.configfs]: [2] [sys.usb.controller]: [a600000.dwc3] [sys.usb.mtp.batchcancel]: [1] [sys.usb.mtp.device_type]: [3] ``` </details> does not help experimentally.
Author
Owner

adb root does not help, see #39#issuecomment-3991.

`adb root` does not help, see [#39#issuecomment-3991](https://gitea.lemnoslife.com/Benjamin_Loison/adb/issues/39#issuecomment-3991).
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Benjamin_Loison/adb#22
No description provided.