Open eighthave opened 3 years ago
This is an easier format to parse:
~ $ udevadm info --query property --path /sys/devices/pci0000:00/0000:00:14.0/usb2/2-2/2-2.1
DEVPATH=/devices/pci0000:00/0000:00:14.0/usb2/2-2/2-2.1
DEVNAME=/dev/bus/usb/002/087
DEVTYPE=usb_device
DRIVER=usb
PRODUCT=18d1/4ee2/228
TYPE=0/0/0
BUSNUM=002
DEVNUM=087
MAJOR=189
MINOR=214
SUBSYSTEM=usb
USEC_INITIALIZED=403267347302
ID_VENDOR=asus
ID_VENDOR_ENC=asus
ID_VENDOR_ID=18d1
ID_MODEL=Nexus_7
ID_MODEL_ENC=Nexus\x207
ID_MODEL_ID=4ee2
ID_REVISION=0228
ID_SERIAL=asus_Nexus_7_05995813
ID_SERIAL_SHORT=05995813
ID_BUS=usb
ID_USB_INTERFACES=:ffff00:ff4201:
ID_VENDOR_FROM_DATABASE=Google Inc.
GPHOTO2_DRIVER=PTP
ID_GPHOTO2=1
ID_MEDIA_PLAYER=1
ID_MODEL_FROM_DATABASE=Nexus Device (debug)
adb_user=yes
ID_MTP_DEVICE=1
ID_PATH=pci-0000:00:14.0-usb-0:2.1
ID_PATH_TAG=pci-0000_00_14_0-usb-0_2_1
ID_FOR_SEAT=usb-pci-0000_00_14_0-usb-0_2_1
COLORD_DEVICE=1
COLORD_KIND=camera
DEVLINKS=/dev/libmtp-2-2.1
TAGS=:seat:uaccess:
Since
sudo
is only needed to install udev rules, this should first check whether the required udev rules are installed. The user could have already done it manually, or they could have installed the distro's package that includes these rules. Here's a sketch of how to check: