GithubHelp home page GithubHelp logo

tejado / android-usb-gadget Goto Github PK

View Code? Open in Web Editor NEW
809.0 28.0 68.0 538 KB

Convert your Android phone to any USB device you like! USB Gadget Tool allows you to create and activate USB device roles, like a mouse or a keyboard. 🛠🛡📱

License: GNU General Public License v3.0

Java 1.77% Shell 22.49% Kotlin 75.74%
android usb gadget kernel configfs usb-hid usb-devices ctap ctap2 ccid

android-usb-gadget's Introduction

USB Gadget Tool

USB Gadget Tool Screenshot

Convert your Android phone to any USB device you like!
USB Gadget Tool allows you to create and activate USB device roles, like a mouse or a keyboard. Connected USB hosts (e.g. a normal computer) will then identify your Android device only under that role. It can also be used to deactivate the standard USB Gadget (including mtp, adb, etc.), e.g. for security reasons.

Following USB gadgets are integrated:

  • Keyboard & Mouse (/dev/hidg0, /dev/hidg1)
  • FIDO CTAP (/dev/hidg0; for WebAuthn)
  • CCID (/dev/ccid_ctrl, /dev/ccid_bulk)
  • UVC camera (/dev/video?)

USB Gadget Tool requires root permissions and a Kernel with ConfigFS support. Currently the app only enables the USB Gadget. For the usage of these device endpoints (e.g. /dev/hidg0) further apps are required (see Use-Cases).

Get it on F-Droid

Use-Cases

Features

  • Comfortable USB gadget management (listing, adding and activating)
  • Adding & activating USB Gadgets during boot
  • Adding functions to USB Gadgets
  • Device info (Kernel version and available gadgets in Kernel)
  • Available in F-Droid store

Roadmap

  • Mount of /config if not available
  • Alert if ConfigFS is not supported
  • Import custom USB Gadget profiles
  • Example USB Gadget usage (USB Gadget Tool currently only manages USB Gadgets, not implementations of these)
  • Optional telemetry to understand better how all the Android vendors compile their kernel (e.g. what USB Gadgets are available)
  • Google Play Store distribution

How does it work?

USB Gadget Tool uses ConfigFS - an userspace API inside the Linux Kernel - for creation of arbitrary USB composite devices. https://www.kernel.org/doc/Documentation/filesystems/configfs/configfs.txt

android-usb-gadget's People

Contributors

izzysoft avatar poussinou avatar tejado avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

android-usb-gadget's Issues

Trying to write in an none existing folder ?

Hi,
I'm currently trying to get this work on a Pixel 6A running android 13.

Reading the logs I noticed an issue:

So this is the interesting part of the logs

ROOT - Execute command: #!/bin/sh
 
CONFIGFS_DIR="/config"
GADGETS_PATH="${CONFIGFS_DIR}/usb_gadget"
 
GADGET="keyboard"
GADGET_PATH=${GADGETS_PATH}/${GADGET}
 
CONFIG_PATH="$GADGET_PATH/configs/c.1/"
STRINGS_PATH="$GADGET_PATH/strings/0x409/"
 
mkdir -p $CONFIG_PATH
mkdir -p $STRINGS_PATH
 
mkdir -p $GADGET_PATH/functions/hid.keyboard
cd $GADGET_PATH/functions/hid.keyboard
 
# HID protocol (according to USB spec: 1 for keyboard)
echo 1 > protocol
# device subclass
echo 1 > subclass
# number of bytes per record
echo 8 > report_length
 
# writing report descriptor
echo -ne \\x05\\x01\\x09\\x06\\xa1\\x01\\x05\\x07\\x19\\xe0\\x29\\xe7\\x15\\x00\\x25\\x01\\x75\\x01\\x95\\x08\\x81\\x02\\x95\\x01\\x75\\x08\\x81\\x03\\x95\\x05\\x75\\x01\\x05\\x08\\x19\\x01\\x29\\x05\\x91\\x02\\x95\\x01\\x75\\x03\\x91\\x03\\x95\\x06\\x75\\x08\\x15\\x00\\x25\\x65\\x05\\x07\\x19\\x00\\x29\\x65\\x81\\x00\\xc0 > report_desc

mkdir -p $GADGET_PATH/functions/hid.mouse
cd $GADGET_PATH/functions/hid.mouse
 
# HID protocol (according to USB spec: 2 for mouse)
echo 2 > protocol
# device subclass
echo 1 > subclass
# number of bytes per record
echo 4 > report_length
 
# writing report descriptor
echo -ne \\x05\\x01\\x09\\x02\\xa1\\x01\\x09\\x01\\xa1\\x00\\x05\\x09\\x19\\x01\\x29\\x05\\x15\\x00\\x25\\x01\\x95\\x05\\x75\\x01\\x81\\x02\\x95\\x01\\x75\\x03\\x81\\x01\\x05\\x01\\x09\\x30\\x09\\x31\\x09\\x38\\x15\\x81\\x25\\x7F\\x75\\x08\\x95\\x03\\x81\\x06\\xc0\\xc0 > report_desc
 
 
cd $GADGET_PATH
echo 0x046a > idVendor
echo 0x002a > idProduct
 
cd $STRINGS_PATH
echo "tejado" > manufacturer
echo "Android USB Gadget" > product
echo "42" > serialnumber
 
cd $CONFIG_PATH
echo 120 > MaxPower
echo "Configuration" > strings/0x409/configuration
 
ln -s ${GADGET_PATH}/functions/hid.keyboard $CONFIG_PATH/hid.keyboard
ln -s ${GADGET_PATH}/functions/hid.mouse $CONFIG_PATH/hid.mouse
 
ROOT (stdout) - 
ROOT (stderr) - : <stdin>[53]: can't create strings/0x409/configuration: No such file or directory

As you can see I get the following error ROOT (stderr) - : <stdin>[53]: can't create strings/0x409/configuration: No such file or directory

Which seems normal as this directory is not created by the script.
Indeed the strings folder created is $GADGET_PATH/strings/0x409/ which corresponds to /config/usb_gadget/keyboard/strings/0x409/ different from $CONFIG_PATH/strings/0x409/configuration which resolves to /config/usb_gadget/keyboard/configs/c.1//strings/0x409/configuration

Is there a quick fix for this issue?

Thanks in advance

superuser rights denied

When starting up usb-gadget, superuser rights immediately get denied. I have rooted my device with magisk, other apps with root permission are working fine. Thanks for the help

UVC function can't be added

Hi, I can't add UVC function... in device info is showed with red color"not set"... somebody has the same issue? how to fix it?

Crash report

App crashes while click on either DEVICE INFO or LOGS

FATAL EXCEPTION: main
Process: net.tjado.usbgadget, PID: 6614
java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.String.length()' on a null object reference
	at java.io.StringReader.<init>(StringReader.java:50)
	at net.tjado.usbgadget.GadgetShellApi.lambda$updateDeviceInfo$0(GadgetShellApi.java:52)
	at net.tjado.usbgadget.-$$Lambda$GadgetShellApi$2MbiYVtUUtsiThLGWXZp__L4lqc.OnRootTaskFinish(Unknown Source:2)
	at net.tjado.usbgadget.RootTask.onPostExecute(RootTask.java:37)
	at net.tjado.usbgadget.RootTask.onPostExecute(RootTask.java:6)
	at android.os.AsyncTask.finish(AsyncTask.java:695)
	at android.os.AsyncTask.-wrap1(Unknown Source:0)
	at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:712)
	at android.os.Handler.dispatchMessage(Handler.java:106)
	at android.os.Looper.loop(Looper.java:164)
	at android.app.ActivityThread.main(ActivityThread.java:6518)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

Function Name

Existing functions are linked as function0, function1, ...
When a new function is added with the gadget it does not follow the same naming structure

redfin:/config/usb_gadget/g1/configs/b.1 # ls -al

drwxr-xr-x 3 system system 0 2021-02-27 00:15 ..
-rw-r--r-- 1 system system 4096 2021-02-27 00:15 MaxPower
-rw-r--r-- 1 system system 4096 2021-02-27 00:15 bmAttributes
lrwxrwxrwx 1 root root 0 2021-03-02 09:49 diag.diag -> ../../../../usb_gadget/g1/functions/diag.diag
lrwxrwxrwx 1 root root 0 2021-02-27 00:15 function0 -> ../../../../usb_gadget/g1/functions/ffs.adb
drwxr-xr-x 2 system system 0 2021-02-27 00:15 strings

Add Function not working

Hi @tejado , I am currently using kernel version 4.4 on my device. Whenever I clicked on Keyboard and Mouse from 'Add Function to Gadget', there are nothing happened on my device. 'hid.panel' does not appeared after I added them, can you please check on this issue? thanks

no gadgets

this is the logs:

ROOT - Execute command: for dir in /config/usb_gadget/*/; do echo GADGET_PATH=$dir; cd $dir/configs/; echo CONFIG_PATH="$dir/configs/ls -1 | head -1/"; cd $dir; if [ "$?" -ne "0" ]; then echo "Error - not able to change dir to $dir... exit"; exit 1; fi; echo UDC=$(cat UDC); find ./configs/ -type l -exec sh -c 'echo FUNCTIONS_ACTIVE=$(basename $(readlink "$@"))' _ {} \;; for f in ./functions/*/; do echo FUNCTIONS=$(basename $f); done; cd ./strings/0x409/; for vars in *; do echo ${vars}=$(cat $vars); done; echo "============="; done; 

ROOT (stdout) - GADGET_PATH=/config/usb_gadget/*/
CONFIG_PATH=/config/usb_gadget/*//configs/acct/
Error - not able to change dir to /config/usb_gadget/*/... exit

ROOT (stderr) - : <stdin>[1]: cd: /config/usb_gadget/*/configs: No such file or directory
: <stdin>[1]: cd: /config/usb_gadget/*: No such file or directory
root - length=1; index=1
ROOT - Execute command: echo KERNEL_VERSION=(uname -r |cut -d '-' -f1 ) && (gunzip -c /proc/config.gz | grep -i configfs | sed 's/# //; s/ is not set/=NOT_SET/')

ROOT (stdout) - KERNEL_VERSION=4.4.83+

ROOT (stderr) - : <stdin>[1]: gunzip: not found

Support SDK 25?

It seems that the minimum supported SDK version is currently 26. Is it possible to also support SDK 25 (i.e., Android 7)? I have a LineageOS device for which only ROMs up to Android 7 are available, thus the installation fails:

Failed to install B:\app-release.apk: Failure [INSTALL_FAILED_OLDER_SDK: Failed parse during installPackageLI: /data/app/vmdl1785514132.tmp/base.apk (at Binary XML file line #7): Requires newer sdk version #26 (current version is #25)]

There was a problem while parsing the package

I tried both release apks on Moto G (falcon) running rooted Lineage os 14.1 and Redmi note4 (mido) running stock MIUI but getting error "There was a problem while parsing the package" while trying to open apk. I understand kernels of these devices are old but I don't know why this error is coming? Excuse if I don't know basic things.

I tried same apk in stock Redmi Note7S and it opens. just saying the app requires root to work. I know this is for rooted devices and just given a try.

Not working on Samsung S10 5G HID gadget

I've used this lovely tool on another more recent Samsung device and that did work. However, on this relatively old device, it does not work due to #12 at first. It did not create the HID gadget profile as that out of memory popped out. Fortunately, following your discussion on how later android kernel source fixed that issue also works for me. I added static int gadget_index in the beginning and changed device = device_create(android_class, NULL, MKDEV(0, 0), NULL, "android0"); to device = device_create(android_class, NULL, MKDEV(0, 0), NULL, "android%d", gadget_index++);. After that, I'm able to create a gadget as shown.
img

However, when I click on that enable button, it goes back to the disabled state automatically within 2 secs and no hidg endpoints get created. I didn't really find useful info in logs.
img
img
May you give me some advice, please? I kinda need a solution as my machine is still down, and I don't have a keyboard...

UVC Support

This issue documents the work to get UVC up & running with android-usb-gadget.

Persistent functions?

Hi, I've noticed that rebooting a device results in all the additional functions configured to be reset. Didn't find any setting for persisting the configuration so far. Can this be a feature request or are there some Android limitations that prevent implementing this?

ADB stopped working in MTP mode

I did some settings to set up VoLTE few times as I was trying to set it up and now my PC ADB cannot see the device (Oneplus 10 Pro). I've turned off and on UBS debugging, which didn't help. I can cofirm USB MTP is working still fine, only ADB does not. As I realised, ADB is now working only in PTP mode. Device manager seems to be ok too. Is there something to reset it to the default (except doing factory reset)?

Kernel 5.10 strange behaviour (Pixel 6a)

I have been using usb-gadget tool for a while on my Xiaomi 11 Lite (Kernel 4.14) and no problem.
But I recently purchased a Pixel 6a (kernel 5.10), /dev/hidg0 and /dev/hidg1 are present and enabled.

The strange thing is that when I execute a command on /dev/hidg0
e.g.

echo h i | ./hid-gadget /dev/hidg0 keyboard

The output is reflected on the mobile phone itself instead of the device that should be connected (PC or another device ..).

For /dev/hidg1 the output is "Success" but nothing happen, seems my PC does not recognize my phone as an HID device, unlike my other Xiaomi phone running under kernel 4.14

Do you have any idea why it behaves this way?

Logs

ROOT (stderr) - 
GadgetShellApi - Gadget Path is valid
ROOT - Execute command: find /config/usb_gadget/  -name UDC -type f -exec sh -c 'echo "" >  "$@"' _ {} \;

ROOT - Execute command: getprop sys.usb.controller > /config/usb_gadget/MouseKeyboard//UDC

ROOT (stdout) - 
ROOT (stderr) - 
ROOT - Execute command: for dir in /config/usb_gadget/*/; do echo GADGET_PATH=$dir; cd $dir/configs/; echo CONFIG_PATH="$dir/configs/`ls -1 | head -1`/"; cd $dir; if [ "$?" -ne "0" ]; then echo "Error - not able to change dir to $dir... exit"; exit 1; fi; echo UDC=$(cat UDC); find ./configs/ -type l -exec sh -c 'echo FUNCTIONS_ACTIVE=$(basename $(readlink "$@"))' _ {} \;; for f in `ls -1 ./functions/`; do echo FUNCTIONS=$f; done; cd ./strings/0x409/; for vars in *; do echo ${vars}=$(cat $vars); done; echo "============="; done; 

ROOT (stdout) - GADGET_PATH=/config/usb_gadget/MouseKeyboard/
CONFIG_PATH=/config/usb_gadget/MouseKeyboard//configs/c.1/
UDC=dummy_udc.0
FUNCTIONS_ACTIVE=hid.mouse
FUNCTIONS_ACTIVE=hid.keyboard
FUNCTIONS=hid.keyboard
FUNCTIONS=hid.mouse
manufacturer=tejado
product=Android USB Gadget
serialnumber=42
=============
GADGET_PATH=/config/usb_gadget/g1/
CONFIG_PATH=/config/usb_gadget/g1//configs/b.1/
UDC=
FUNCTIONS_ACTIVE=ffs.adb
FUNCTIONS=accessory.gs2
FUNCTIONS=acm.gs6
FUNCTIONS=acm.uwb0
FUNCTIONS=audio_source.gs3
FUNCTIONS=dm.gs7
FUNCTIONS=etr_miu.gs11
FUNCTIONS=ffs.adb
FUNCTIONS=ffs.mtp
FUNCTIONS=ffs.ptp
FUNCTIONS=midi.gs5
FUNCTIONS=ncm.gs9
manufacturer=Google
product=Pixel 6a
serialnumber=2A466JWGX11679
=============

ROOT (stderr) - 
ROOT - Execute command: echo KERNEL_VERSION=`(uname -r |cut -d '-' -f1 )` && (gunzip -c /proc/config.gz | grep -i configfs | sed 's/# //; s/ is not set/=NOT_SET/')

ROOT (stdout) - KERNEL_VERSION=5.10.161
CONFIG_PCI_ENDPOINT_CONFIGFS=NOT_SET
CONFIG_USB_CONFIGFS=y
CONFIG_USB_CONFIGFS_UEVENT=y
CONFIG_USB_CONFIGFS_SERIAL=y
CONFIG_USB_CONFIGFS_ACM=y
CONFIG_USB_CONFIGFS_OBEX=NOT_SET
CONFIG_USB_CONFIGFS_NCM=y
CONFIG_USB_CONFIGFS_ECM=y
CONFIG_USB_CONFIGFS_ECM_SUBSET=NOT_SET
CONFIG_USB_CONFIGFS_RNDIS=NOT_SET
CONFIG_USB_CONFIGFS_EEM=y
CONFIG_USB_CONFIGFS_MASS_STORAGE=y
CONFIG_USB_CONFIGFS_F_LB_SS=NOT_SET
CONFIG_USB_CONFIGFS_F_FS=y
CONFIG_USB_CONFIGFS_F_ACC=y
CONFIG_USB_CONFIGFS_F_AUDIO_SRC=y
CONFIG_USB_CONFIGFS_F_UAC1=NOT_SET
CONFIG_USB_CONFIGFS_F_UAC1_LEGACY=NOT_SET
CONFIG_USB_CONFIGFS_F_UAC2=y
CONFIG_USB_CONFIGFS_F_MIDI=y
CONFIG_USB_CONFIGFS_F_HID=y
CONFIG_USB_CONFIGFS_F_UVC=y
CONFIG_USB_CONFIGFS_F_PRINTER=NOT_SET
CONFIG_IIO_CONFIGFS=NOT_SET
CONFIG_CONFIGFS_FS=y

ROOT (stderr) - 

Can't add functions/missing configs under /config

ROOT - Execute command: for dir in /config/usb_gadget//; do echo GADGET_PATH=$dir; cd $dir/configs/; echo CONFIG_PATH="$dir/configs/ls -1 | head -1/"; cd $dir; if [ "$?" -ne "0" ]; then echo "Error - not able to change dir to $dir... exit"; exit 1; fi; echo UDC=$(cat UDC); find ./configs/ -type l -exec sh -c 'echo FUNCTIONS_ACTIVE=$(basename $(readlink "$@"))' _ {} ;; for f in ./functions//; do echo FUNCTIONS=$(basename $f); done; cd ./strings/0x409/; for vars in *; do echo ${vars}=$(cat $vars); done; echo "============="; done;

ROOT (stdout) - GADGET_PATH=/config/usb_gadget//
CONFIG_PATH=/config/usb_gadget/
//configs/acct/
Error - not able to change dir to /config/usb_gadget/*/... exit

ROOT (stderr) - : [1]: cd: /config/usb_gadget//configs: No such file or directory
: [1]: cd: /config/usb_gadget/
: No such file or directory
root - length=1; index=1
ROOT - Execute command: echo KERNEL_VERSION=(uname -r |cut -d '-' -f1 ) && (gunzip -c /proc/config.gz | grep -i configfs | sed 's/# //; s/ is not set/=NOT_SET/')

ROOT (stdout) - KERNEL_VERSION=3.4.113

ROOT (stderr) - gunzip: /proc/config.gz: No such file or directory
ROOT - Execute command: #!/bin/sh

CONFIGFS_DIR="/config"
GADGETS_PATH="${CONFIGFS_DIR}/usb_gadget"

GADGET="keyboard"
GADGET_PATH=${GADGETS_PATH}/${GADGET}

CONFIG_PATH="$GADGET_PATH/configs/c.1/"
STRINGS_PATH="$GADGET_PATH/strings/0x409/"

mkdir -p $CONFIG_PATH
mkdir -p $STRINGS_PATH

mkdir -p $GADGET_PATH/functions/hid.keyboard
cd $GADGET_PATH/functions/hid.keyboard

HID protocol (according to USB spec: 1 for keyboard)

echo 1 > protocol

device subclass

echo 1 > subclass

number of bytes per record

echo 8 > report_length

writing report descriptor

echo -ne \x05\x01\x09\x06\xa1\x01\x05\x07\x19\xe0\x29\xe7\x15\x00\x25\x01\x75\x01\x95\x08\x81\x02\x95\x01\x75\x08\x81\x03\x95\x05\x75\x01\x05\x08\x19\x01\x29\x05\x91\x02\x95\x01\x75\x03\x91\x03\x95\x06\x75\x08\x15\x00\x25\x65\x05\x07\x19\x00\x29\x65\x81\x00\xc0 > report_desc

mkdir -p $GADGET_PATH/functions/hid.mouse
cd $GADGET_PATH/functions/hid.mouse

HID protocol (according to USB spec: 2 for mouse)

echo 2 > protocol

device subclass

echo 1 > subclass

number of bytes per record

echo 4 > report_length

writing report descriptor

echo -ne \x05\x01\x09\x02\xa1\x01\x09\x01\xa1\x00\x05\x09\x19\x01\x29\x05\x15\x00\x25\x01\x95\x05\x75\x01\x81\x02\x95\x01\x75\x03\x81\x01\x05\x01\x09\x30\x09\x31\x09\x38\x15\x81\x25\x7F\x75\x08\x95\x03\x81\x06\xc0\xc0 > report_desc

cd $GADGET_PATH
echo 0x046a > idVendor
echo 0x002a > idProduct

cd $STRINGS_PATH
echo "tejado" > manufacturer
echo "Android USB Gadget" > product
echo "42" > serialnumber

cd $CONFIG_PATH
echo 120 > MaxPower
echo "Configuration" > strings/0x409/configuration

ln -s ${GADGET_PATH}/functions/hid.keyboard $CONFIG_PATH/hid.keyboard
ln -s ${GADGET_PATH}/functions/hid.mouse $CONFIG_PATH/hid.mouse

ROOT (stdout) -
ROOT (stderr) - mkdir: '/config/usb_gadget': Operation not permitted
mkdir: '/config/usb_gadget': Operation not permitted
mkdir: '/config/usb_gadget': Operation not permitted
: [16]: cd: /config/usb_gadget/keyboard/functions/hid.keyboard: No such file or directory
: [19]: can't create protocol: Read-only file system
: [21]: can't create subclass: Read-only file system
: [23]: can't create report_length: Read-only file system
: [26]: can't create report_desc: Read-only file system
mkdir: '/config/usb_gadget': Operation not permitted
: [29]: cd: /config/usb_gadget/keyboard/functions/hid.mouse: No such file or directory
: [32]: can't create protocol: Read-only file system
: [34]: can't create subclass: Read-only file system
: [36]: can't create report_length: Read-only file system
: [39]: can't create report_desc: Read-only file system
: [42]: cd: /config/usb_gadget/keyboard: No such file or directory
: [43]: can't create idVendor: Read-only file system
: [44]: can't create idProduct: Read-only file system
: [46]: cd: /config/usb_gadget/keyboard/strings/0x409: No such file or directory
: [47]: can't create manufacturer: Read-only file system
: [48]: can't create product: Is a directory
: [49]: can't create serialnumber: Read-only file system
: [51]: cd: /config/usb_gadget/keyboard/configs/c.1: No such file or directory
: [52]: can't create MaxPower: Read-only file system
: [53]: can't create strings/0x409/configuration: No such file or directory
ln: cannot create symbolic link from '/config/usb_gadget/keyboard/functions/hid.keyboard' to '/config/usb_gadget/keyboard/configs/c.1//hid.keyboard': No such file or directory
ln: cannot create symbolic link from '/config/usb_gadget/keyboard/functions/hid.mouse' to '/config/usb_gadget/keyboard/configs/c.1//hid.mouse': No such file or directory
ROOT - Execute command: for dir in /config/usb_gadget//; do echo GADGET_PATH=$dir; cd $dir/configs/; echo CONFIG_PATH="$dir/configs/ls -1 | head -1/"; cd $dir; if [ "$?" -ne "0" ]; then echo "Error - not able to change dir to $dir... exit"; exit 1; fi; echo UDC=$(cat UDC); find ./configs/ -type l -exec sh -c 'echo FUNCTIONS_ACTIVE=$(basename $(readlink "$@"))' _ {} ;; for f in ./functions//; do echo FUNCTIONS=$(basename $f); done; cd ./strings/0x409/; for vars in *; do echo ${vars}=$(cat $vars); done; echo "============="; done;

ROOT (stdout) - GADGET_PATH=/config/usb_gadget//
CONFIG_PATH=/config/usb_gadget/
//configs/acct/
Error - not able to change dir to /config/usb_gadget/*/... exit

ROOT (stderr) - : [1]: cd: /config/usb_gadget//configs: No such file or directory
: [1]: cd: /config/usb_gadget/
: No such file or directory
root - length=1; index=1

compilation error

  1. get this error : tjado.usbgadge: open libmigui.so failed! dlopen - dlopen failed: library "libmigui.so" not found

compiled with Android Studio on a windows PC
version : Android Studio Electric Eel | 2022.1.1
Build #AI-221.6008.13.2211.9477386, built on January 11, 2023
Runtime version: 11.0.15+0-b2043.56-8887301 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 11 10.0
GC: G1 Young Generation, G1 Old Generation
Memory: 4096M
Cores: 8
Registry:
external.system.auto.import.disabled=true
ide.text.editor.with.preview.show.floating.toolbar=false

  1. Is it necessary to root the smartphone, in order to use this app ?

Alert if ConfigFS is not supported

Implement a configfs support check, e.g. over the kernel version. It is also possible to check if certain gadgets are available over the kernel (/proc/config.tgz -> CONFIG_USB_F_ flags)

Can it be accessed by terminal emulators like termux ?

I am sorry, if this is not the right place to ask this question.

I was using a ducky program that required the usb-gadget-test.
Every time I ran the script I needed to manually turn on and off the hid toogle which can be annoying.
Is it possible to do it dirrectly using a command that I can put in the script that will,

Turn on hid
Run script(send keypress or whatever)
Turn of hid

??

Thanks in advance.

Dont work

ROOT - Execute command: for dir in /config/usb_gadget//; do echo GADGET_PATH=$dir; cd $dir/configs/; echo CONFIG_PATH="$dir/configs/ls -1 | head -1/"; cd $dir; if [ "$?" -ne "0" ]; then echo "Error - not able to change dir to $dir... exit"; exit 1; fi; echo UDC=$(cat UDC); find ./configs/ -type l -exec sh -c 'echo FUNCTIONS_ACTIVE=$(basename $(readlink "$@"))' _ {} ;; for f in ./functions//; do echo FUNCTIONS=$(basename $f); done; cd ./strings/0x409/; for vars in *; do echo ${vars}=$(cat $vars); done; echo "============="; done;

ROOT (stdout) - GADGET_PATH=/config/usb_gadget//
CONFIG_PATH=/config/usb_gadget/
//configs/acct/
Error - not able to change dir to /config/usb_gadget/*/... exit

ROOT (stderr) - : [1]: cd: /config/usb_gadget//configs: No such file or directory
: [1]: cd: /config/usb_gadget/
: No such file or directory
root - length=1; index=1
ROOT - Execute command: echo KERNEL_VERSION=(uname -r |cut -d '-' -f1 ) && (gunzip -c /proc/config.gz | grep -i configfs | sed 's/# //; s/ is not set/=NOT_SET/')

ROOT (stdout) - KERNEL_VERSION=3.4.113

ROOT (stderr) - gunzip: /proc/config.gz: No such file or directory
ROOT - Execute command: for dir in /config/usb_gadget//; do echo GADGET_PATH=$dir; cd $dir/configs/; echo CONFIG_PATH="$dir/configs/ls -1 | head -1/"; cd $dir; if [ "$?" -ne "0" ]; then echo "Error - not able to change dir to $dir... exit"; exit 1; fi; echo UDC=$(cat UDC); find ./configs/ -type l -exec sh -c 'echo FUNCTIONS_ACTIVE=$(basename $(readlink "$@"))' _ {} ;; for f in ./functions//; do echo FUNCTIONS=$(basename $f); done; cd ./strings/0x409/; for vars in *; do echo ${vars}=$(cat $vars); done; echo "============="; done;

ROOT (stdout) - GADGET_PATH=/config/usb_gadget//
CONFIG_PATH=/config/usb_gadget/
//configs/acct/
Error - not able to change dir to /config/usb_gadget/*/... exit

ROOT (stderr) - : [1]: cd: /config/usb_gadget//configs: No such file or directory
: [1]: cd: /config/usb_gadget/
: No such file or directory
root - length=1; index=1
ROOT - Execute command: #!/bin/sh

CONFIGFS_DIR="/config"
GADGETS_PATH="${CONFIGFS_DIR}/usb_gadget"

GADGET="keyboard"
GADGET_PATH=${GADGETS_PATH}/${GADGET}

CONFIG_PATH="$GADGET_PATH/configs/c.1/"
STRINGS_PATH="$GADGET_PATH/strings/0x409/"

mkdir -p $CONFIG_PATH
mkdir -p $STRINGS_PATH

mkdir -p $GADGET_PATH/functions/hid.keyboard
cd $GADGET_PATH/functions/hid.keyboard

HID protocol (according to USB spec: 1 for keyboard)

echo 1 > protocol

device subclass

echo 1 > subclass

number of bytes per record

echo 8 > report_length

writing report descriptor

echo -ne \x05\x01\x09\x06\xa1\x01\x05\x07\x19\xe0\x29\xe7\x15\x00\x25\x01\x75\x01\x95\x08\x81\x02\x95\x01\x75\x08\x81\x03\x95\x05\x75\x01\x05\x08\x19\x01\x29\x05\x91\x02\x95\x01\x75\x03\x91\x03\x95\x06\x75\x08\x15\x00\x25\x65\x05\x07\x19\x00\x29\x65\x81\x00\xc0 > report_desc

mkdir -p $GADGET_PATH/functions/hid.mouse
cd $GADGET_PATH/functions/hid.mouse

HID protocol (according to USB spec: 2 for mouse)

echo 2 > protocol

device subclass

echo 1 > subclass

number of bytes per record

echo 4 > report_length

writing report descriptor

echo -ne \x05\x01\x09\x02\xa1\x01\x09\x01\xa1\x00\x05\x09\x19\x01\x29\x05\x15\x00\x25\x01\x95\x05\x75\x01\x81\x02\x95\x01\x75\x03\x81\x01\x05\x01\x09\x30\x09\x31\x09\x38\x15\x81\x25\x7F\x75\x08\x95\x03\x81\x06\xc0\xc0 > report_desc

cd $GADGET_PATH
echo 0x046a > idVendor
echo 0x002a > idProduct

cd $STRINGS_PATH
echo "tejado" > manufacturer
echo "Android USB Gadget" > product
echo "42" > serialnumber

cd $CONFIG_PATH
echo 120 > MaxPower
echo "Configuration" > strings/0x409/configuration

ln -s ${GADGET_PATH}/functions/hid.keyboard $CONFIG_PATH/hid.keyboard
ln -s ${GADGET_PATH}/functions/hid.mouse $CONFIG_PATH/hid.mouse

ROOT (stdout) -
ROOT (stderr) - mkdir: '/config/usb_gadget': Operation not permitted
mkdir: '/config/usb_gadget': Operation not permitted
mkdir: '/config/usb_gadget': Operation not permitted
: [16]: cd: /config/usb_gadget/keyboard/functions/hid.keyboard: No such file or directory
: [19]: can't create protocol: Read-only file system
: [21]: can't create subclass: Read-only file system
: [23]: can't create report_length: Read-only file system
: [26]: can't create report_desc: Read-only file system
mkdir: '/config/usb_gadget': Operation not permitted
: [29]: cd: /config/usb_gadget/keyboard/functions/hid.mouse: No such file or directory
: [32]: can't create protocol: Read-only file system
: [34]: can't create subclass: Read-only file system
: [36]: can't create report_length: Read-only file system
: [39]: can't create report_desc: Read-only file system
: [42]: cd: /config/usb_gadget/keyboard: No such file or directory
: [43]: can't create idVendor: Read-only file system
: [44]: can't create idProduct: Read-only file system
: [46]: cd: /config/usb_gadget/keyboard/strings/0x409: No such file or directory
: [47]: can't create manufacturer: Read-only file system
: [48]: can't create product: Is a directory
: [49]: can't create serialnumber: Read-only file system
: [51]: cd: /config/usb_gadget/keyboard/configs/c.1: No such file or directory
: [52]: can't create MaxPower: Read-only file system
: [53]: can't create strings/0x409/configuration: No such file or directory
ln: cannot create symbolic link from '/config/usb_gadget/keyboard/functions/hid.keyboard' to '/config/usb_gadget/keyboard/configs/c.1//hid.keyboard': No such file or directory
ln: cannot create symbolic link from '/config/usb_gadget/keyboard/functions/hid.mouse' to '/config/usb_gadget/keyboard/configs/c.1//hid.mouse': No such file or directory
ROOT - Execute command: for dir in /config/usb_gadget//; do echo GADGET_PATH=$dir; cd $dir/configs/; echo CONFIG_PATH="$dir/configs/ls -1 | head -1/"; cd $dir; if [ "$?" -ne "0" ]; then echo "Error - not able to change dir to $dir... exit"; exit 1; fi; echo UDC=$(cat UDC); find ./configs/ -type l -exec sh -c 'echo FUNCTIONS_ACTIVE=$(basename $(readlink "$@"))' _ {} ;; for f in ./functions//; do echo FUNCTIONS=$(basename $f); done; cd ./strings/0x409/; for vars in *; do echo ${vars}=$(cat $vars); done; echo "============="; done;

ROOT (stdout) - GADGET_PATH=/config/usb_gadget//
CONFIG_PATH=/config/usb_gadget/
//configs/acct/
Error - not able to change dir to /config/usb_gadget/*/... exit

ROOT (stderr) - : [1]: cd: /config/usb_gadget//configs: No such file or directory
: [1]: cd: /config/usb_gadget/
: No such file or directory
root - length=1; index=1

UVC for webcam

Will there be an update to support uvc to allow the device as a pnp webcam?

Samsung Galaxy Z Fold4 doesn't recognise Xiaomi Mi6 as keyboard

Hi @tejado

As you already know, the Authorizer app now works for me in the Xiaomi-Mac bundle. But now I have a problem with my actual phone. I use Galaxy Z Fold4, and this thing doesn't want to treat my Xiaomi as a keyboard - just nothing happens. It doesn't even show me that a physical keyboard is plugged in.

I though this might be some issue with my config of USB GT. I created a separate device in USB GT, but still Samsung uses Xiaomi only as a charger 🤦

Support for Lineage os 14

I am using lineage os 14.1 (android 7.1)(androidsdk 25) but as far as I know this app supports minsdk 26, is it somehow possible to use it in sdk25.

Doesnt add hidg devices

When adding "keyboard&mouse", it doesnt work, there are no hidg devices in /dev/

ROOT - Execute command: for dir in /config/usb_gadget/*/; do echo GADGET_PATH=$dir; cd $dir/configs/; echo CONFIG_PATH="$dir/configs/`ls -1 | head -1`/"; cd $dir; if [ "$?" -ne "0" ]; then echo "Error - not able to change dir to $dir... exit"; exit 1; fi; echo UDC=$(cat UDC); find ./configs/ -type l -exec sh -c 'echo FUNCTIONS_ACTIVE=$(basename $(readlink "$@"))' _ {} \;; for f in ./functions/*/; do echo FUNCTIONS=$(basename $f); done; cd ./strings/0x409/; for vars in *; do echo ${vars}=$(cat $vars); done; echo "============="; done; 

ROOT (stdout) - GADGET_PATH=/config/usb_gadget/g1/
CONFIG_PATH=/config/usb_gadget/g1//configs/b.1/
UDC=10c00000.dwc3
FUNCTIONS_ACTIVE=ncm.0
FUNCTIONS_ACTIVE=audio_source.0
FUNCTIONS_ACTIVE=accessory.0
FUNCTIONS_ACTIVE=midi.0
FUNCTIONS_ACTIVE=conn_gadget.0
FUNCTIONS_ACTIVE=dm1.0
FUNCTIONS_ACTIVE=dm.0
FUNCTIONS_ACTIVE=rndis.0
FUNCTIONS_ACTIVE=acm.0
FUNCTIONS_ACTIVE=ffs.adb
FUNCTIONS_ACTIVE=ptp.0
FUNCTIONS_ACTIVE=mtp.0
FUNCTIONS=accessory.0
FUNCTIONS=acm.0
FUNCTIONS=audio_source.0
FUNCTIONS=conn_gadget.0
FUNCTIONS=dm.0
FUNCTIONS=dm1.0
FUNCTIONS=ffs.adb
FUNCTIONS=midi.0
FUNCTIONS=mtp.0
FUNCTIONS=ncm.0
FUNCTIONS=ptp.0
FUNCTIONS=rndis.0
manufacturer=SAMSUNG
product=SAMSUNG_Android
serialnumber=RF8M21X9GVM
=============

ROOT (stderr) - 
ROOT - Execute command: echo KERNEL_VERSION=`(uname -r |cut -d '-' -f1 )` && (gunzip -c /proc/config.gz | grep -i configfs | sed 's/# //; s/ is not set/=NOT_SET/')

ROOT (stdout) - KERNEL_VERSION=4.14.113
CONFIG_USB_CONFIGFS=y
CONFIG_USB_CONFIGFS_SERIAL=NOT_SET
CONFIG_USB_CONFIGFS_ACM=y
CONFIG_USB_CONFIGFS_OBEX=NOT_SET
CONFIG_USB_CONFIGFS_NCM=y
CONFIG_USB_CONFIGFS_ECM=NOT_SET
CONFIG_USB_CONFIGFS_ECM_SUBSET=NOT_SET
CONFIG_USB_CONFIGFS_RNDIS=y
CONFIG_USB_CONFIGFS_EEM=NOT_SET
CONFIG_USB_CONFIGFS_MASS_STORAGE=NOT_SET
CONFIG_USB_CONFIGFS_F_LB_SS=NOT_SET
CONFIG_USB_CONFIGFS_F_FS=y
CONFIG_USB_CONFIGFS_F_DM=y
CONFIG_USB_CONFIGFS_F_ADB=NOT_SET
CONFIG_USB_CONFIGFS_F_MTP=y
CONFIG_USB_CONFIGFS_F_PTP=y
CONFIG_USB_CONFIGFS_F_CONN_GADGET=y
CONFIG_USB_CONFIGFS_F_ACC=y
CONFIG_USB_CONFIGFS_F_AUDIO_SRC=y
CONFIG_USB_CONFIGFS_UEVENT=y
CONFIG_USB_CONFIGFS_F_UAC1=NOT_SET
CONFIG_USB_CONFIGFS_F_UAC1_LEGACY=NOT_SET
CONFIG_USB_CONFIGFS_F_UAC2=NOT_SET
CONFIG_USB_CONFIGFS_F_MIDI=y
CONFIG_USB_CONFIGFS_F_HID=NOT_SET
CONFIG_USB_CONFIGFS_F_UVC=NOT_SET
CONFIG_USB_CONFIGFS_F_PRINTER=NOT_SET
CONFIG_IIO_CONFIGFS=NOT_SET
CONFIG_CONFIGFS_FS=y

ROOT (stderr) - 
ROOT - Execute command: #!/bin/sh

CONFIGFS_DIR="/config"
GADGETS_PATH="${CONFIGFS_DIR}/usb_gadget"

GADGET="keyboard"
GADGET_PATH=${GADGETS_PATH}/${GADGET}

CONFIG_PATH="$GADGET_PATH/configs/c.1/"
STRINGS_PATH="$GADGET_PATH/strings/0x409/"

mkdir -p $CONFIG_PATH
mkdir -p $STRINGS_PATH

mkdir -p $GADGET_PATH/functions/hid.keyboard
cd $GADGET_PATH/functions/hid.keyboard

# HID protocol (according to USB spec: 1 for keyboard)
echo 1 > protocol
# device subclass
echo 1 > subclass
# number of bytes per record
echo 8 > report_length

# writing report descriptor
echo -ne \\x05\\x01\\x09\\x06\\xa1\\x01\\x05\\x07\\x19\\xe0\\x29\\xe7\\x15\\x00\\x25\\x01\\x75\\x01\\x95\\x08\\x81\\x02\\x95\\x01\\x75\\x08\\x81\\x03\\x95\\x05\\x75\\x01\\x05\\x08\\x19\\x01\\x29\\x05\\x91\\x02\\x95\\x01\\x75\\x03\\x91\\x03\\x95\\x06\\x75\\x08\\x15\\x00\\x25\\x65\\x05\\x07\\x19\\x00\\x29\\x65\\x81\\x00\\xc0 > report_desc

mkdir -p $GADGET_PATH/functions/hid.mouse
cd $GADGET_PATH/functions/hid.mouse

# HID protocol (according to USB spec: 2 for mouse)
echo 2 > protocol
# device subclass
echo 1 > subclass
# number of bytes per record
echo 4 > report_length

# writing report descriptor
echo -ne \\x05\\x01\\x09\\x02\\xa1\\x01\\x09\\x01\\xa1\\x00\\x05\\x09\\x19\\x01\\x29\\x05\\x15\\x00\\x25\\x01\\x95\\x05\\x75\\x01\\x81\\x02\\x95\\x01\\x75\\x03\\x81\\x01\\x05\\x01\\x09\\x30\\x09\\x31\\x09\\x38\\x15\\x81\\x25\\x7F\\x75\\x08\\x95\\x03\\x81\\x06\\xc0\\xc0 > report_desc


cd $GADGET_PATH
echo 0x046a > idVendor
echo 0x002a > idProduct

cd $STRINGS_PATH
echo "tejado" > manufacturer
echo "Android USB Gadget" > product
echo "42" > serialnumber

cd $CONFIG_PATH
echo 120 > MaxPower
echo "Configuration" > strings/0x409/configuration

ln -s ${GADGET_PATH}/functions/hid.keyboard $CONFIG_PATH/hid.keyboard
ln -s ${GADGET_PATH}/functions/hid.mouse $CONFIG_PATH/hid.mouse

ROOT (stdout) - 
ROOT (stderr) - mkdir: can't create directory '/config/usb_gadget/keyboard/': Cannot allocate memory
mkdir: can't create directory '/config/usb_gadget/keyboard/': Cannot allocate memory
mkdir: can't create directory '/config/usb_gadget/keyboard/': Cannot allocate memory
: <stdin>[16]: cd: /config/usb_gadget/keyboard/functions/hid.keyboard: No such file or directory
: <stdin>[19]: can't create protocol: Read-only file system
: <stdin>[21]: can't create subclass: Read-only file system
: <stdin>[23]: can't create report_length: Read-only file system
: <stdin>[26]: can't create report_desc: Read-only file system
mkdir: can't create directory '/config/usb_gadget/keyboard/': Cannot allocate memory
: <stdin>[29]: cd: /config/usb_gadget/keyboard/functions/hid.mouse: No such file or directory
: <stdin>[32]: can't create protocol: Read-only file system
: <stdin>[34]: can't create subclass: Read-only file system
: <stdin>[36]: can't create report_length: Read-only file system
: <stdin>[39]: can't create report_desc: Read-only file system
: <stdin>[42]: cd: /config/usb_gadget/keyboard: No such file or directory
: <stdin>[43]: can't create idVendor: Read-only file system
: <stdin>[44]: can't create idProduct: Read-only file system
: <stdin>[46]: cd: /config/usb_gadget/keyboard/strings/0x409: No such file or directory
: <stdin>[47]: can't create manufacturer: Read-only file system
: <stdin>[48]: can't create product: Is a directory
: <stdin>[49]: can't create serialnumber: Read-only file system
: <stdin>[51]: cd: /config/usb_gadget/keyboard/configs/c.1: No such file or directory
: <stdin>[52]: can't create MaxPower: Read-only file system
: <stdin>[53]: can't create strings/0x409/configuration: No such file or directory
ln: /config/usb_gadget/keyboard/configs/c.1//hid.keyboard: No such file or directory
ln: /config/usb_gadget/keyboard/configs/c.1//hid.mouse: No such file or directory
ROOT - Execute command: for dir in /config/usb_gadget/*/; do echo GADGET_PATH=$dir; cd $dir/configs/; echo CONFIG_PATH="$dir/configs/`ls -1 | head -1`/"; cd $dir; if [ "$?" -ne "0" ]; then echo "Error - not able to change dir to $dir... exit"; exit 1; fi; echo UDC=$(cat UDC); find ./configs/ -type l -exec sh -c 'echo FUNCTIONS_ACTIVE=$(basename $(readlink "$@"))' _ {} \;; for f in ./functions/*/; do echo FUNCTIONS=$(basename $f); done; cd ./strings/0x409/; for vars in *; do echo ${vars}=$(cat $vars); done; echo "============="; done; 

ROOT (stdout) - GADGET_PATH=/config/usb_gadget/g1/
CONFIG_PATH=/config/usb_gadget/g1//configs/b.1/
UDC=10c00000.dwc3
FUNCTIONS_ACTIVE=ncm.0
FUNCTIONS_ACTIVE=audio_source.0
FUNCTIONS_ACTIVE=accessory.0
FUNCTIONS_ACTIVE=midi.0
FUNCTIONS_ACTIVE=conn_gadget.0
FUNCTIONS_ACTIVE=dm1.0
FUNCTIONS_ACTIVE=dm.0
FUNCTIONS_ACTIVE=rndis.0
FUNCTIONS_ACTIVE=acm.0
FUNCTIONS_ACTIVE=ffs.adb
FUNCTIONS_ACTIVE=ptp.0
FUNCTIONS_ACTIVE=mtp.0
FUNCTIONS=accessory.0
FUNCTIONS=acm.0
FUNCTIONS=audio_source.0
FUNCTIONS=conn_gadget.0
FUNCTIONS=dm.0
FUNCTIONS=dm1.0
FUNCTIONS=ffs.adb
FUNCTIONS=midi.0
FUNCTIONS=mtp.0
FUNCTIONS=ncm.0
FUNCTIONS=ptp.0
FUNCTIONS=rndis.0
manufacturer=SAMSUNG
product=SAMSUNG_Android
serialnumber=RF8M21X9GVM
=============

ROOT (stderr) - 

Samsung Galaxy S10
Magisk 20.4
Android 10

Phone 100% reboots when writing keyboard data into /dev/hidg1 after USB unplugged

I have successfully made an APP to change my Android to a USB Keyoard by writing data into /dev/hidg1 after using GSB Gadget Tool ----add function --- Keyboard !! That's really cool. The only question is why my Android 100% reboots automaticly when i unplug the USB from my computer and then write a keyboard data to /dev/hidg1.

And i want adding new USB function "GamePad" into USB Gadget Tool !! Thanks a lot !!

i grant root to app but when i open this app i cant show anything in Gadgets section

this is my log
################################
ROOT - Execute command: for dir in /config/usb_gadget//; do echo GADGET_PATH=$dir; cd $dir/configs/; echo CONFIG_PATH="$dir/configs/ls -1 | head -1/"; cd $dir; if [ "$?" -ne "0" ]; then echo "Error - not able to change dir to $dir... exit"; exit 1; fi; echo UDC=$(cat UDC); find ./configs/ -type l -exec sh -c 'echo FUNCTIONS_ACTIVE=$(basename $(readlink "$@"))' _ {} ;; for f in ./functions//; do echo FUNCTIONS=$(basename $f); done; cd ./strings/0x409/; for vars in *; do echo ${vars}=$(cat $vars); done; echo "============="; done;

ROOT (stdout) - GADGET_PATH=/config/usb_gadget//
CONFIG_PATH=/config/usb_gadget///configs/acct/
Error - not able to change dir to /config/usb_gadget/*/... exit

ROOT (stderr) - : [1]: cd: /config/usb_gadget//configs: No such file or directory
: [1]: cd: /config/usb_gadget/: No such file or directory
root - length=1; index=1
ROOT - Execute command: echo KERNEL_VERSION=(uname -r |cut -d '-' -f1 ) && (gunzip -c /proc/config.gz | grep -i configfs | sed 's/# //; s/ is not set/=NOT_SET/')

ROOT (stdout) - KERNEL_VERSION=4.4.83+
CONFIG_USB_CONFIGFS=NOT_SET
CONFIG_CONFIGFS_FS=y

ROOT (stderr) -
##########################
WhatsApp Image 2021-04-22 at 6 10 29 PM (1)
WhatsApp Image 2021-04-22 at 6 10 29 PM

Phone reboots after trying to add the keyboard + mouse devicr

I can't add the keyboard and mouse devices, because my phone freezes for a while and then reboots

ROOT - Execute command: for dir in /config/usb_gadget/*/; do echo GADGET_PATH=$dir; cd $dir/configs/; echo CONFIG_PATH="$dir/configs/ls -1 | head -1`/"; cd $dir; if [ "$?" -ne "0" ]; then echo "Error - not able to change dir to $dir... exit"; exit 1; fi; echo UDC=$(cat UDC); find ./configs/ -type l -exec sh -c 'echo FUNCTIONS_ACTIVE=$(basename $(readlink "$@"))' _ {} ;; for f in ./functions/*/; do echo FUNCTIONS=$(basename $f); done; cd ./strings/0x409/; for vars in *; do echo ${vars}=$(cat $vars); done; echo "============="; done;

ROOT (stdout) - GADGET_PATH=/config/usb_gadget/g1/
CONFIG_PATH=/config/usb_gadget/g1//configs/b.1/
UDC=a600000.dwc3
FUNCTIONS_ACTIVE=ffs.adb
FUNCTIONS=accessory.gs2
FUNCTIONS=audio_source.gs3
FUNCTIONS=ccid.ccid
FUNCTIONS=cser.dun.0
FUNCTIONS=cser.dun.2
FUNCTIONS=cser.nmea.1
FUNCTIONS=diag.diag
FUNCTIONS=diag.diag_mdm
FUNCTIONS=diag.diag_mdm2
FUNCTIONS=ffs.adb
FUNCTIONS=ffs.diag
FUNCTIONS=ffs.diag_mdm
FUNCTIONS=ffs.diag_mdm2
FUNCTIONS=gsi.dpl
FUNCTIONS=gsi.rmnet
FUNCTIONS=gsi.rndis
FUNCTIONS=mass_storage.0
FUNCTIONS=midi.gs5
FUNCTIONS=mtp.gs0
FUNCTIONS=ncm.0
FUNCTIONS=ptp.gs1
FUNCTIONS=qdss.qdss
FUNCTIONS=qdss.qdss_mdm
FUNCTIONS=rndis.rndis
manufacturer=Xiaomi
product=POCO F1
serialnumber=b192cba7

GADGET_PATH=/config/usb_gadget/g2/
CONFIG_PATH=/config/usb_gadget/g2//configs/b.1/
UDC=
FUNCTIONS=*
manufacturer=Xiaomi
product=POCO F1
serialnumber=b192cba7

ROOT (stderr) -
ROOT - Execute command: echo KERNEL_VERSION=(uname -r |cut -d '-' -f1 ) && (gunzip -c /proc/config.gz | grep -i configfs | sed 's/# //; s/ is not set/=NOT_SET/')

ROOT (stdout) - KERNEL_VERSION=4.9.274
CONFIG_USB_CONFIGFS=y
CONFIG_USB_CONFIGFS_SERIAL=y
CONFIG_USB_CONFIGFS_ACM=y
CONFIG_USB_CONFIGFS_OBEX=y
CONFIG_USB_CONFIGFS_NCM=y
CONFIG_USB_CONFIGFS_ECM=y
CONFIG_USB_CONFIGFS_ECM_SUBSET=y
CONFIG_USB_CONFIGFS_QCRNDIS=NOT_SET
CONFIG_USB_CONFIGFS_RNDIS=y
CONFIG_USB_CONFIGFS_EEM=y
CONFIG_USB_CONFIGFS_MASS_STORAGE=y
CONFIG_USB_CONFIGFS_F_LB_SS=NOT_SET
CONFIG_USB_CONFIGFS_F_FS=y
CONFIG_USB_CONFIGFS_F_MTP=y
CONFIG_USB_CONFIGFS_F_PTP=y
CONFIG_USB_CONFIGFS_F_ACC=y
CONFIG_USB_CONFIGFS_F_AUDIO_SRC=y
CONFIG_USB_CONFIGFS_UEVENT=y
CONFIG_USB_CONFIGFS_F_UAC1=NOT_SET
CONFIG_USB_CONFIGFS_F_UAC2=NOT_SET
CONFIG_USB_CONFIGFS_F_MIDI=y
CONFIG_USB_CONFIGFS_F_HID=y
CONFIG_USB_CONFIGFS_F_UVC=NOT_SET
CONFIG_USB_CONFIGFS_F_PRINTER=NOT_SET
CONFIG_USB_CONFIGFS_F_DIAG=y
CONFIG_USB_CONFIGFS_F_CDEV=y
CONFIG_USB_CONFIGFS_F_CCID=y
CONFIG_USB_CONFIGFS_F_GSI=y
CONFIG_USB_CONFIGFS_F_QDSS=y
CONFIG_USB_CONFIGFS_F_IPC=NOT_SET
CONFIG_IIO_CONFIGFS=NOT_SET
CONFIG_CONFIGFS_FS=y

ROOT (stderr) - `

Samsung S9 cant create keyboard gadget or add keyboard function

When trying to add the keyboard function to the default gadget I get the following:

`ROOT (stderr) -
GadgetShellApi - Gadget Path is valid
ROOT - Execute command: #!/bin/sh

GADGET="keyboard"
GADGET_PATH="/config/usb_gadget/g1/"

cd $GADGET_PATH/configs/
CONFIG_PATH="$GADGET_PATH/configs/ls -1 | head -1/"
STRINGS_PATH="$GADGET_PATH/strings/0x409/"

mkdir -p $GADGET_PATH/functions/hid.keyboard
cd $GADGET_PATH/functions/hid.keyboard

HID protocol (according to USB spec: 1 for keyboard)

echo 1 > protocol

device subclass

echo 1 > subclass

number of bytes per record

echo 8 > report_length

writing report descriptor

echo -ne \x05\x01\x09\x06\xa1\x01\x05\x07\x19\xe0\x29\xe7\x15\x00\x25\x01\x75\x01\x95\x08\x81\x02\x95\x01\x75\x08\x81\x03\x95\x05\x75\x01\x05\x08\x19\x01\x29\x05\x91\x02\x95\x01\x75\x03\x91\x03\x95\x06\x75\x08\x15\x00\x25\x65\x05\x07\x19\x00\x29\x65\x81\x00\xc0 > report_desc

ln -s ${GADGET_PATH}/functions/hid.keyboard $CONFIG_PATH/hid.keyboard

ROOT (stdout) -
ROOT (stderr) - mkdir: '/config/usb_gadget/g1//functions/hid.keyboard': No such file or directory
: [12]: cd: /config/usb_gadget/g1/functions/hid.keyboard: No such file or directory
: [15]: can't create protocol: Permission denied
: [17]: can't create subclass: Permission denied
: [19]: can't create report_length: Permission denied
: [22]: can't create report_desc: Permission denied
ln: cannot create symbolic link from '/config/usb_gadget/g1//functions/hid.keyboard' to '/config/usb_gadget/g1//configs/b.1//hid.keyboard': No such file or directory
ROOT - Execute command: for dir in /config/usb_gadget//; do echo GADGET_PATH=$dir; cd $dir/configs/; echo CONFIG_PATH="$dir/configs/ls -1 | head -1/"; cd $dir; if [ "$?" -ne "0" ]; then echo "Error - not able to change dir to $dir... exit"; exit 1; fi; echo UDC=$(cat UDC); find ./configs/ -type l -exec sh -c 'echo FUNCTIONS_ACTIVE=$(basename $(readlink "$@"))' _ {} ;; for f in ./functions//; do echo FUNCTIONS=$(basename $f); done; cd ./strings/0x409/; for vars in *; do echo ${vars}=$(cat $vars); done; echo "============="; done;

ROOT (stdout) - GADGET_PATH=/config/usb_gadget/g1/
CONFIG_PATH=/config/usb_gadget/g1//configs/b.1/
UDC=10c00000.dwc3
FUNCTIONS_ACTIVE=ncm.0
FUNCTIONS_ACTIVE=audio_source.0
FUNCTIONS_ACTIVE=accessory.0
FUNCTIONS_ACTIVE=midi.0
FUNCTIONS_ACTIVE=conn_gadget.0
FUNCTIONS_ACTIVE=dm.0
FUNCTIONS_ACTIVE=rndis.0
FUNCTIONS_ACTIVE=acm.0
FUNCTIONS_ACTIVE=ffs.adb
FUNCTIONS_ACTIVE=ptp.0
FUNCTIONS_ACTIVE=mtp.0
FUNCTIONS=accessory.0
FUNCTIONS=acm.0
FUNCTIONS=audio_source.0
FUNCTIONS=conn_gadget.0
FUNCTIONS=dm.0
FUNCTIONS=ffs.adb
FUNCTIONS=midi.0
FUNCTIONS=mtp.0
FUNCTIONS=ncm.0
FUNCTIONS=ptp.0
FUNCTIONS=rndis.0
manufacturer=samsung
product=SM-G960F
serialnumber=2a62ec9a06047ece
=============`

I couldnt enable CONFIGFS_F_HID in my lineageos ROM (linker errors), so its disabled if that makes a difference.

F-Droid ;)

What about adding this app to f-droid?

out of memory

I am running lineageos 18.1 (android 11 with magisk root) on a samsung note 9 N-960f. I was met with the same issue with OneUI2.5 rom (android 10 with magisk root). I have downloaded the source and tried manually executing the shellscripts for gadget creation but it gives the same 'out of memory' error. I also tried manually creating the directories within /config/usb_gadget and i get the same 'out of memory' error.

ROOT (stdout): GADGET_PATH=/config/usb_gadget/g1/
    CONFIG_PATH=/config/usb_gadget/g1//configs/b.1/
    UDC=10c00000.dwc3
    FUNCTIONS_ACTIVE=ffs.adb
    FUNCTIONS_ACTIVE=ncm.0
    FUNCTIONS_ACTIVE=audio_source.0
    FUNCTIONS_ACTIVE=accessory.0
    FUNCTIONS_ACTIVE=midi.0
    FUNCTIONS_ACTIVE=conn_gadget.0
    FUNCTIONS_ACTIVE=dm.0
    FUNCTIONS_ACTIVE=rndis.0
    FUNCTIONS_ACTIVE=acm.0
    FUNCTIONS_ACTIVE=ffs.adb
    FUNCTIONS_ACTIVE=ptp.0
    FUNCTIONS_ACTIVE=mtp.0
    FUNCTIONS=accessory.0
    FUNCTIONS=acm.0
    FUNCTIONS=audio_source.0
    FUNCTIONS=conn_gadget.0
    FUNCTIONS=dm.0
    FUNCTIONS=ffs.adb
    FUNCTIONS=midi.0
    FUNCTIONS=mtp.0
    FUNCTIONS=ncm.0
    FUNCTIONS=ptp.0
    FUNCTIONS=rndis.0
    manufacturer=SAMSUNG
    product=SAMSUNG_Android
    serialnumber=###
    =============
2021-04-14 09:34:54.227 1482-1482/net.tjado.usbgadget W/tjado.usbgadge: Accessing hidden method Landroid/graphics/FontFamily;-><init>()V (greylist-max-q, reflection, allowed)
2021-04-14 09:34:54.227 1482-1482/net.tjado.usbgadget W/tjado.usbgadge: Accessing hidden method Landroid/graphics/FontFamily;->addFontFromAssetManager(Landroid/content/res/AssetManager;Ljava/lang/String;IZIII[Landroid/graphics/fonts/FontVariationAxis;)Z (greylist-max-q, reflection, allowed)
2021-04-14 09:34:54.227 1482-1482/net.tjado.usbgadget W/tjado.usbgadge: Accessing hidden method Landroid/graphics/FontFamily;->addFontFromBuffer(Ljava/nio/ByteBuffer;I[Landroid/graphics/fonts/FontVariationAxis;II)Z (greylist-max-q, reflection, allowed)
2021-04-14 09:34:54.227 1482-1482/net.tjado.usbgadget W/tjado.usbgadge: Accessing hidden method Landroid/graphics/FontFamily;->freeze()Z (greylist-max-q, reflection, allowed)
2021-04-14 09:34:54.227 1482-1482/net.tjado.usbgadget W/tjado.usbgadge: Accessing hidden method Landroid/graphics/FontFamily;->abortCreation()V (greylist-max-q, reflection, allowed)
2021-04-14 09:34:54.227 1482-1482/net.tjado.usbgadget W/tjado.usbgadge: Accessing hidden method Landroid/graphics/Typeface;->createFromFamiliesWithDefault([Landroid/graphics/FontFamily;Ljava/lang/String;II)Landroid/graphics/Typeface; (greylist, reflection, allowed)
2021-04-14 09:34:58.352 1482-8452/net.tjado.usbgadget I/mali_winsys: new_window_surface() [1725x926] return: 0x3000
2021-04-14 09:35:01.039 1482-8470/net.tjado.usbgadget D/ROOT: Execute command: #!/bin/sh
    
    CONFIGFS_DIR="/config"
    GADGETS_PATH="${CONFIGFS_DIR}/usb_gadget"
    
    GADGET="keyboard"
    GADGET_PATH=${GADGETS_PATH}/${GADGET}
    
    CONFIG_PATH="$GADGET_PATH/configs/c.1/"
    STRINGS_PATH="$GADGET_PATH/strings/0x409/"
    
    mkdir -p $CONFIG_PATH
    mkdir -p $STRINGS_PATH
    
    mkdir -p $GADGET_PATH/functions/hid.keyboard
    cd $GADGET_PATH/functions/hid.keyboard
    
    # HID protocol (according to USB spec: 1 for keyboard)
    echo 1 > protocol
    # device subclass
    echo 1 > subclass
    # number of bytes per record
    echo 8 > report_length
    
    # writing report descriptor
    echo -ne \\x05\\x01\\x09\\x06\\xa1\\x01\\x05\\x07\\x19\\xe0\\x29\\xe7\\x15\\x00\\x25\\x01\\x75\\x01\\x95\\x08\\x81\\x02\\x95\\x01\\x75\\x08\\x81\\x03\\x95\\x05\\x75\\x01\\x05\\x08\\x19\\x01\\x29\\x05\\x91\\x02\\x95\\x01\\x75\\x03\\x91\\x03\\x95\\x06\\x75\\x08\\x15\\x00\\x25\\x65\\x05\\x07\\x19\\x00\\x29\\x65\\x81\\x00\\xc0 > report_desc
    
    mkdir -p $GADGET_PATH/functions/hid.mouse
    cd $GADGET_PATH/functions/hid.mouse
    
    # HID protocol (according to USB spec: 2 for mouse)
    echo 2 > protocol
    # device subclass
    echo 1 > subclass
    # number of bytes per record
    echo 4 > report_length
    
    # writing report descriptor
    echo -ne \\x05\\x01\\x09\\x02\\xa1\\x01\\x09\\x01\\xa1\\x00\\x05\\x09\\x19\\x01\\x29\\x05\\x15\\x00\\x25\\x01\\x95\\x05\\x75\\x01\\x81\\x02\\x95\\x01\\x75\\x03\\x81\\x01\\x05\\x01\\x09\\x30\\x09\\x31\\x09\\x38\\x15\\x81\\x25\\x7F\\x75\\x08\\x95\\x03\\x81\\x06\\xc0\\xc0 > report_desc
    
    
    cd $GADGET_PATH
    echo 0x046a > idVendor
    echo 0x002a > idProduct
    
    cd $STRINGS_PATH
    echo "tejado" > manufacturer
    echo "Android USB Gadget" > product
    echo "42" > serialnumber
    
    cd $CONFIG_PATH
    echo 120 > MaxPower
    echo "Configuration" > strings/0x409/configuration
    
    ln -s ${GADGET_PATH}/functions/hid.keyboard $CONFIG_PATH/hid.keyboard
    ln -s ${GADGET_PATH}/functions/hid.mouse $CONFIG_PATH/hid.mouse
2021-04-14 09:35:01.041 1482-8452/net.tjado.usbgadget I/mali_egl: eglDestroySurface() in
2021-04-14 09:35:01.043 1482-8452/net.tjado.usbgadget I/mali_winsys: delete_surface() [1725x926] return
2021-04-14 09:35:01.043 1482-8452/net.tjado.usbgadget I/mali_egl: eglDestroySurface() out
2021-04-14 09:35:01.043 1482-8452/net.tjado.usbgadget W/libEGL: EGLNativeWindowType 0x75155f0950 disconnect failed
2021-04-14 09:35:01.043 1482-8452/net.tjado.usbgadget D/OpenGLRenderer: endAllActiveAnimators on 0x74955cc890 (AlertController$RecycleListView) with handle 0x73b5620530
2021-04-14 09:35:01.119 1482-8470/net.tjado.usbgadget D/ROOT (stderr): mkdir: '/config/usb_gadget/keyboard': Out of memory
    mkdir: '/config/usb_gadget/keyboard': Out of memory
    mkdir: '/config/usb_gadget/keyboard': Out of memory
    : <stdin>[16]: cd: /config/usb_gadget/keyboard/functions/hid.keyboard: No such file or directory
    : <stdin>[19]: can't create protocol: Read-only file system
    : <stdin>[21]: can't create subclass: Read-only file system
    : <stdin>[23]: can't create report_length: Read-only file system
    : <stdin>[26]: can't create report_desc: Read-only file system
    mkdir: '/config/usb_gadget/keyboard': Out of memory

Is it possible to use this app as a library?

I want to prototype a device that acts as a mouse and control it from opencv app , for my purpose i need to build it as a aar lib, is it possible to build such binary or there is an easier way to it?

App is crashing..

07-24 21:39:24.404 7691-7691/? I/art: Late-enabling -Xcheck:jni
07-24 21:39:24.528 7691-7691/? W/System: ClassLoader referenced unknown path: /data/app/net.tjado.usbgadget-1/lib/arm
07-24 21:39:24.713 7691-7691/net.tjado.usbgadget W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter androidx.vectordrawable.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
07-24 21:39:24.821 7691-7691/net.tjado.usbgadget V/BoostFramework: mAcquireFunc method = public int com.qualcomm.qti.Performance.perfLockAcquire(int,int[])
07-24 21:39:24.821 7691-7691/net.tjado.usbgadget V/BoostFramework: mReleaseFunc method = public int com.qualcomm.qti.Performance.perfLockRelease()
07-24 21:39:24.821 7691-7691/net.tjado.usbgadget V/BoostFramework: mAcquireTouchFunc method = public int com.qualcomm.qti.Performance.perfLockAcquireTouch(android.view.MotionEvent,android.util.DisplayMetrics,int,int[])
07-24 21:39:24.821 7691-7691/net.tjado.usbgadget V/BoostFramework: mIOPStart method = public int com.qualcomm.qti.Performance.perfIOPrefetchStart(int,java.lang.String)
07-24 21:39:24.821 7691-7691/net.tjado.usbgadget V/BoostFramework: mIOPStop method = public int com.qualcomm.qti.Performance.perfIOPrefetchStop()
07-24 21:39:24.827 7691-7691/net.tjado.usbgadget V/BoostFramework: BoostFramework() : mPerf = com.qualcomm.qti.Performance@c02fdb3
07-24 21:39:24.828 7691-7691/net.tjado.usbgadget V/BoostFramework: BoostFramework() : mPerf = com.qualcomm.qti.Performance@204bf70
07-24 21:39:24.842 7691-7691/net.tjado.usbgadget I/art: Rejecting re-init on previously-failed class java.lang.Class<androidx.core.view.ViewCompat$2>
07-24 21:39:24.844 7691-7691/net.tjado.usbgadget I/art: Rejecting re-init on previously-failed class java.lang.Class<androidx.core.view.ViewCompat$2>
07-24 21:39:25.090 7691-7691/net.tjado.usbgadget V/BoostFramework: BoostFramework() : mPerf = com.qualcomm.qti.Performance@b74d35d
07-24 21:39:25.090 7691-7691/net.tjado.usbgadget V/BoostFramework: BoostFramework() : mPerf = com.qualcomm.qti.Performance@1284d2
07-24 21:39:25.213 7691-7691/net.tjado.usbgadget V/BoostFramework: BoostFramework() : mPerf = com.qualcomm.qti.Performance@701c1e
07-24 21:39:25.214 7691-7691/net.tjado.usbgadget V/BoostFramework: BoostFramework() : mPerf = com.qualcomm.qti.Performance@5814cff
07-24 21:39:25.222 7691-7691/net.tjado.usbgadget V/BoostFramework: BoostFramework() : mPerf = com.qualcomm.qti.Performance@9bdaacc
07-24 21:39:25.484 7691-7764/net.tjado.usbgadget D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
07-24 21:39:25.522 7691-7756/net.tjado.usbgadget D/ROOT: Execute command: for dir in /config/usb_gadget/*/; do echo GADGET_PATH=$dir; cd $dir/configs/; echo CONFIG_PATH="$dir/configs/`ls -1 | head -1`/"; cd $dir; if [ "$?" -ne "0" ]; then echo "Error - not able to change dir to $dir... exit"; exit 1; fi; echo UDC=$(cat UDC); find ./configs/ -type l -exec sh -c 'echo FUNCTIONS_ACTIVE=$(basename $(readlink "$@"))' _ {} \;; for f in ./functions/*/; do echo FUNCTIONS=$(basename $f); done; cd ./strings/0x409/; for vars in *; do echo ${vars}=$(cat $vars); done; echo "============="; done; 
07-24 21:39:25.586 7691-7764/net.tjado.usbgadget I/Adreno-EGL: <qeglDrvAPI_eglInitialize:379>: EGL 1.4 QUALCOMM build: Nondeterministic_AU_msm8909_LA.BR.1.2.7.C1__release_AU (I741a3d36ca)
    OpenGL ES Shader Compiler Version: E031.29.00.00
    Build Date: 09/22/16 Thu
    Local Branch: 
    Remote Branch: quic/LA.BR.1.2.7.c1
    Local Patches: NONE
    Reconstruct Branch: NOTHING
07-24 21:39:25.590 7691-7764/net.tjado.usbgadget I/OpenGLRenderer: Initialized EGL, version 1.4
07-24 21:39:25.699 7691-7691/net.tjado.usbgadget V/BoostFramework: BoostFramework() : mPerf = com.qualcomm.qti.Performance@9323824
07-24 21:39:25.700 7691-7691/net.tjado.usbgadget V/BoostFramework: BoostFramework() : mPerf = com.qualcomm.qti.Performance@7550f8d
07-24 21:39:25.753 7691-7691/net.tjado.usbgadget W/ResourceType: Failure getting entry for 0x7f070062 (t=6 e=98) (error -75)
07-24 21:39:25.763 7691-7691/net.tjado.usbgadget W/ResourceType: Failure getting entry for 0x7f07005f (t=6 e=95) (error -75)
07-24 21:39:25.763 7691-7691/net.tjado.usbgadget W/ResourceType: Failure getting entry for 0x7f070061 (t=6 e=97) (error -75)
07-24 21:39:25.784 7691-7691/net.tjado.usbgadget W/ResourceType: Failure getting entry for 0x7f070062 (t=6 e=98) (error -75)
07-24 21:39:25.785 7691-7691/net.tjado.usbgadget D/AndroidRuntime: Shutting down VM
    
    
    --------- beginning of crash
07-24 21:39:25.787 7691-7691/net.tjado.usbgadget E/AndroidRuntime: FATAL EXCEPTION: main
    Process: net.tjado.usbgadget, PID: 7691
    android.content.res.Resources$NotFoundException: Resource ID #0x7f070062
        at android.content.res.Resources.getValue(Resources.java:1351)
        at androidx.appcompat.widget.ResourceManagerInternal.loadDrawableFromDelegates(ResourceManagerInternal.java:252)
        at androidx.appcompat.widget.ResourceManagerInternal.getDrawable(ResourceManagerInternal.java:139)
        at androidx.appcompat.widget.ResourceManagerInternal.getDrawable(ResourceManagerInternal.java:132)
        at androidx.appcompat.content.res.AppCompatResources.getDrawable(AppCompatResources.java:104)
        at androidx.appcompat.view.menu.MenuItemImpl.getIcon(MenuItemImpl.java:505)
        at androidx.appcompat.view.menu.ActionMenuItemView.initialize(ActionMenuItemView.java:126)
        at androidx.appcompat.widget.ActionMenuPresenter.bindItemView(ActionMenuPresenter.java:207)
        at androidx.appcompat.view.menu.BaseMenuPresenter.getItemView(BaseMenuPresenter.java:188)
        at androidx.appcompat.widget.ActionMenuPresenter.getItemView(ActionMenuPresenter.java:193)
        at androidx.appcompat.widget.ActionMenuPresenter.flagActionItems(ActionMenuPresenter.java:473)
        at androidx.appcompat.view.menu.MenuBuilder.flagActionItems(MenuBuilder.java:1182)
        at androidx.appcompat.view.menu.BaseMenuPresenter.updateMenuView(BaseMenuPresenter.java:96)
        at androidx.appcompat.widget.ActionMenuPresenter.updateMenuView(ActionMenuPresenter.java:226)
        at androidx.appcompat.view.menu.MenuBuilder.dispatchPresenterUpdate(MenuBuilder.java:298)
        at androidx.appcompat.view.menu.MenuBuilder.onItemsChanged(MenuBuilder.java:1069)
        at androidx.appcompat.view.menu.MenuBuilder.startDispatchingItemsChanged(MenuBuilder.java:1096)
        at androidx.appcompat.app.AppCompatDelegateImpl.preparePanel(AppCompatDelegateImpl.java:1788)
        at androidx.appcompat.app.AppCompatDelegateImpl.doInvalidatePanelMenu(AppCompatDelegateImpl.java:2026)
        at androidx.appcompat.app.AppCompatDelegateImpl$2.run(AppCompatDelegateImpl.java:263)
        at android.os.Handler.handleCallback(Handler.java:739)
        at android.os.Handler.dispatchMessage(Handler.java:95)
        at android.os.Looper.loop(Looper.java:148)
        at android.app.ActivityThread.main(ActivityThread.java:5417)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
        at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:107)
07-24 21:39:25.936 7691-7756/net.tjado.usbgadget D/ROOT (stdout): GADGET_PATH=/config/usb_gadget/*/
    CONFIG_PATH=/config/usb_gadget/*//configs//
    Error - not able to change dir to /config/usb_gadget/*/... exit
07-24 21:39:25.936 7691-7756/net.tjado.usbgadget D/ROOT (stderr): : <stdin>[1]: cd: /config/usb_gadget/*/configs: No such file or directory
    ls: Unknown option '-1'. Aborting.
    : <stdin>[1]: cd: /config/usb_gadget/*: No such file or directory

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.