Skip to content

Commit

Permalink
implement thundercomm adb implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
BBBmau committed Dec 12, 2024
1 parent ed7b3d4 commit df2b019
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 92 deletions.
10 changes: 10 additions & 0 deletions userspace/usr/comma/99-android.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Google vendor ID (18d1)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666", GROUP="plugdev", TAG+="uaccess"
SUBSYSTEM=="usb_device", ATTR{idVendor}=="18d1", MODE="0666", GROUP="plugdev", TAG+="uaccess"

# Qualcomm vendor ID (05c6)
SUBSYSTEM=="usb", ATTR{idVendor}=="05c6", MODE="0666", GROUP="plugdev", TAG+="uaccess"
SUBSYSTEM=="usb_device", ATTR{idVendor}=="05c6", MODE="0666", GROUP="plugdev", TAG+="uaccess"

# Additional rules for ADB interface
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", MODE="0666"
90 changes: 0 additions & 90 deletions userspace/usr/comma/adb_usb.sh

This file was deleted.

44 changes: 42 additions & 2 deletions userspace/usr/comma/comma.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,48 @@ handle_setup_keys () {
}

handle_adb () {
sudo systemctl start adbd
bash "$(dirname "$0")/adb_usb.sh start"
# Try to configure USB controller through configfs
sudo mkdir -p /sys/kernel/config/usb_gadget/g1 2>/dev/null || true

cd /sys/kernel/config/usb_gadget/g1

# Basic USB configuration
sudo sh -c 'echo "0x18d1" > idVendor' # Google vendor ID
sudo sh -c 'echo "0x2d01" > idProduct' # Generic ADB product ID

# Create strings directory and add basic info
sudo mkdir -p strings/0x409
sudo sh -c 'echo "Comma.ai" > strings/0x409/manufacturer'
sudo sh -c 'echo "Comma Device" > strings/0x409/product'

# Create configuration
sudo mkdir -p configs/c.1/strings/0x409
sudo sh -c 'echo "ADB Configuration" > configs/c.1/strings/0x409/configuration'

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

sudo mount -o remount,rw /
sudo cp /usr/comma/99-android.rules /etc/udev/rules.d/99-android.rules
sudo chmod 777 /etc/udev/rules.d/99-android.rules
sudo chmod a+r /etc/udev/rules.d/99-android.rules

# Create plugdev group if it doesn't exist
sudo groupadd -f plugdev
sudo usermod -aG plugdev comma

# Restart udev and ADB with debug logging
sudo service udev restart
sudo udevadm control --reload-rules
sudo udevadm trigger

sudo systemctl restart adbd

# Print ADB status for debugging
systemctl status adbd

sudo mount -o remount,ro /
}

# factory reset handling
Expand Down

0 comments on commit df2b019

Please sign in to comment.