Skip to content

Trying to write in an none existing folder ? #42

@SF73

Description

@SF73

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions