Skip to content

Commit

Permalink
switch to awake
Browse files Browse the repository at this point in the history
  • Loading branch information
BBBmau committed Dec 10, 2024
1 parent ebdfa11 commit ed7b3d4
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 19 deletions.
2 changes: 1 addition & 1 deletion agnos-kernel-sdm845
54 changes: 37 additions & 17 deletions userspace/usr/comma/adb_usb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,47 @@

case "$1" in
start)
# Mount configfs and create ADB function
mount -t configfs none /sys/kernel/config
if [ -d /sys/kernel/config/usb_gadget ]; then
cd /sys/kernel/config/usb_gadget
mkdir g1
cd g1
mkdir strings/0x409
mkdir configs/c.1
mkdir configs/c.1/strings/0x409
mkdir functions/ffs.adb

# Set basic device information
echo "6192" > strings/0x409/serialnumber
echo "comma.ai" > strings/0x409/manufacturer
echo "comma 3x" > strings/0x409/product
# First, ensure configfs is mounted
if ! mount | grep -q "configfs on /sys/kernel/config"; then
mount -t configfs none /sys/kernel/config || exit 1
fi

# Mount functionfs for ADB
# Clean up any existing gadget
if [ -d /sys/kernel/config/usb_gadget/g1 ]; then
echo "" > /sys/kernel/config/usb_gadget/g1/UDC
rm -rf /sys/kernel/config/usb_gadget/g1
fi

# Create new gadget
mkdir -p /sys/kernel/config/usb_gadget/g1 || exit 1
cd /sys/kernel/config/usb_gadget/g1

# Configure gadget
echo "0xbbaa" > idVendor
echo "0xddcc" > idProduct

# Create English locale
mkdir -p strings/0x409
echo "6192" > strings/0x409/serialnumber
echo "comma.ai" > strings/0x409/manufacturer
echo "comma 3x" > strings/0x409/product

# Create configuration
mkdir -p configs/c.1/strings/0x409
echo "ADB Config" > configs/c.1/strings/0x409/configuration
echo 500 > configs/c.1/MaxPower

# Create function
mkdir -p functions/ffs.adb
ln -s functions/ffs.adb configs/c.1/

# Set up ADB functionfs
mkdir -p /dev/usb-ffs/adb
mount -o uid=2000,gid=2000 -t functionfs adb /dev/usb-ffs/adb
mount -o remount,gid=5,mode=620 /dev/pts

# Find and enable UDC
UDC=$(ls /sys/class/udc | head -n 1)
echo $UDC > UDC

# Enable USB gadget
if [ -d /sys/class/android_usb/android0 ]; then
Expand Down
Binary file removed userspace/usr/comma/bg.jpg
Binary file not shown.
2 changes: 1 addition & 1 deletion userspace/usr/comma/weston.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[shell]
background-image=/usr/comma/bg.jpg
background-image=/usr/comma/sleep.gif
background-type=scale-crop
close-animation=none

0 comments on commit ed7b3d4

Please sign in to comment.