9 lines
357 B
Plaintext
Raw Normal View History

2024-10-22 21:18:36 -06:00
#!/bin/bash
# Get the vendor and product ID for a USB device path.
# Used in udev rules.
PRODUCTID=$(udevadm info --attribute-walk --path=$1 | grep -m 1 "ATTRS{idProduct}==" | sed 's/^.*=="//' | sed 's/"$//')
VENDORID=$(udevadm info --attribute-walk --path=$1 | grep -m 1 "ATTRS{idVendor}==" | sed 's/^.*=="//' | sed 's/"$//')
echo "$VENDORID:$PRODUCTID"