I’m using a PIC32 pinguino micro card. When entering bootloader mode is recognized as a USB HID device.
2014-01-24T20:53:50.440089+01:00 andromeda kernel: [30052.519372] usb 1-1.4.4: new full-speed USB device number 16 using ehci-pci
2014-01-24T20:53:50.518011+01:00 andromeda kernel: [30052.597836] usb 1-1.4.4: New USB device found, idVendor=04d8, idProduct=003c
2014-01-24T20:53:50.518046+01:00 andromeda kernel: [30052.597849] usb 1-1.4.4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
2014-01-24T20:53:50.518050+01:00 andromeda kernel: [30052.597856] usb 1-1.4.4: Product: USB HID Bootloader
2014-01-24T20:53:50.518053+01:00 andromeda kernel: [30052.597862] usb 1-1.4.4: Manufacturer: Microchip Technology Inc.
2014-01-24T20:53:50.522012+01:00 andromeda kernel: [30052.601121] hid-generic 0003:04D8:003C.000B: hiddev0,hidraw3: USB HID v1.11 Device [Microchip Technology Inc. USB HID Bootloader] on usb-0000:00:12.2-1.4.4/input0
2014-01-24T20:53:50.523839+01:00 andromeda mtp-probe: checking bus 1, device 16: "/sys/devices/pci0000:00/0000:00:12.2/usb1/1-1/1-1.4/1-1.4.4"
2014-01-24T20:53:50.524436+01:00 andromeda mtp-probe: bus: 1, device: 16 was not an MTP device
I use a program called Pinguino IDE to communicate with the device through usb. As root it works fine, but as a normal user it does not work.
I’ve added a udev rule in order to being able to use it as normal user:
I’ve found a solution, but I don’t understand why It works
andromeda:/home/fernando # ls -l /dev/bus
total 0
drwxr-xr-x 11 root root 220 ene 26 10:46 usb
andromeda:/home/fernando # ls -l /dev/bus/usb
total 0
drwxr-xr-x 2 root root 140 ene 26 10:46 001
drwxr-xr-x 2 root root 60 ene 26 10:46 002
drwxr-xr-x 2 root root 60 ene 26 10:46 003
drwxr-xr-x 2 root root 60 ene 26 10:46 004
drwxr-xr-x 2 root root 60 ene 26 10:46 005
drwxr-xr-x 2 root root 80 ene 26 10:46 006
drwxr-xr-x 2 root root 60 ene 26 10:46 007
drwxr-xr-x 2 root root 60 ene 26 10:46 008
drwxr-xr-x 2 root root 60 ene 26 10:46 009
andromeda:/home/fernando # ls -l /dev/bus/usb/001
total 0
crw-rw-r-- 1 root root 189, 0 ene 26 10:46 001
crw-rw-r-- 1 root root 189, 1 ene 26 10:46 002
crw-rw-r-- 1 root root 189, 3 ene 26 10:46 004
crw-rw-r-- 1 root root 189, 5 ene 26 10:46 006
crw-rw-r-- 1 root root 189, 6 ene 26 10:46 007
I plug the device:
andromeda:/home/fernando # tail -f /var/log/messages
2014-01-26T11:07:14.161925+01:00 andromeda kernel: 1237.957932] usb 1-1.4.4: new full-speed USB device number 8 using ehci-pci
2014-01-26T11:07:14.239895+01:00 andromeda kernel: 1238.036404] usb 1-1.4.4: New USB device found, idVendor=04d8, idProduct=003c
2014-01-26T11:07:14.239920+01:00 andromeda kernel: 1238.036416] usb 1-1.4.4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
2014-01-26T11:07:14.239921+01:00 andromeda kernel: 1238.036423] usb 1-1.4.4: Product: USB HID Bootloader
2014-01-26T11:07:14.239922+01:00 andromeda kernel: 1238.036429] usb 1-1.4.4: Manufacturer: Microchip Technology Inc.
2014-01-26T11:07:14.242906+01:00 andromeda kernel: 1238.039127] hid-generic 0003:04D8:003C.0005: hiddev0,hidraw3: USB HID v1.11 Device [Microchip Technology Inc. USB HID Bootloader] on usb-0000:00:12.2-1.4.4/input0
2014-01-26T11:07:14.257529+01:00 andromeda mtp-probe: checking bus 1, device 8: "/sys/devices/pci0000:00/0000:00:12.2/usb1/1-1/1-1.4/1-1.4.4"
2014-01-26T11:07:14.259042+01:00 andromeda mtp-probe: bus: 1, device: 8 was not an MTP device
Then I check permissions
andromeda:/home/fernando # ls -l /dev/hidbl-1-1.4.4
lrwxrwxrwx 1 root root 15 ene 26 11:07 /dev/hidbl-1-1.4.4 -> bus/usb/001/008
andromeda:/home/fernando # ls -l /dev/bus/usb/001
total 0
crw-rw-r-- 1 root root 189, 0 ene 26 10:46 001
crw-rw-r-- 1 root root 189, 1 ene 26 10:46 002
crw-rw-r-- 1 root root 189, 3 ene 26 10:46 004
crw-rw-r-- 1 root root 189, 5 ene 26 10:46 006
crw-rw-r-- 1 root root 189, 6 ene 26 10:46 007
crw-rw-rw- 1 root users 189, 7 ene 26 11:07 008
It seems right, but id does not work as a normal user.
Hi
Anything will work if you change ownership Not sure if it’s a good
solution. You probably just need to refine your udev rule to pick the
correct device(s).
–
Cheers Malcolm °¿° SUSE Knowledge Partner (Linux Counter #276890)
openSUSE 13.1 (Bottle) (x86_64) GNOME 3.10.2 Kernel 3.11.6-4-desktop
If you find this post helpful and are logged into the web interface,
please show your appreciation and click on the star below… Thanks!
Moreover, I’ve tried twice and the first time the “correct” device was
007.
Is there any hidden camera recording me???
Hi
It’s all that tinfoil your wearing…
OK, so when you plug the device in run usb-devices (as root) and see if
can glean some additional information to add the the udev rule to
refine it.
–
Cheers Malcolm °¿° SUSE Knowledge Partner (Linux Counter #276890)
openSUSE 13.1 (Bottle) (x86_64) GNOME 3.10.2 Kernel 3.11.6-4-desktop
If you find this post helpful and are logged into the web interface,
please show your appreciation and click on the star below… Thanks!
and plug in the device. CTRL-C to terminate. From that output, you can use the device path reported, you can check the matching udev rules reported via
udevadm test <device path>
For example
udevadm test /sys/devices/pci0000:00/0000:00:12.2/usb1/1-1/
I unplug it, run “udev-adm monitor” and plug it in again
andromeda:/home/fernando # udevadm monitor
monitor will print the received events for:
UDEV - the event which udev sends out after rule processing
KERNEL - the kernel uevent
KERNEL[23125.446435] add /devices/pci0000:00/0000:00:12.2/usb1/1-1/1-1.4/1-1.4.4 (usb)
KERNEL[23125.447589] add /devices/pci0000:00/0000:00:12.2/usb1/1-1/1-1.4/1-1.4.4/1-1.4.4:1.0 (usb)
KERNEL[23125.448371] add /devices/pci0000:00/0000:00:12.2/usb1/1-1/1-1.4/1-1.4.4/1-1.4.4:1.0/0003:04D8:003C.0006 (hid)
KERNEL[23125.449129] add /devices/pci0000:00/0000:00:12.2/usb1/1-1/1-1.4/1-1.4.4/1-1.4.4:1.0/usbmisc/hiddev1 (usbmisc)
KERNEL[23125.449404] add /devices/pci0000:00/0000:00:12.2/usb1/1-1/1-1.4/1-1.4.4/1-1.4.4:1.0/0003:04D8:003C.0006/hidraw/hidraw3 (hidraw)
UDEV [23125.458851] add /devices/pci0000:00/0000:00:12.2/usb1/1-1/1-1.4/1-1.4.4 (usb)
UDEV [23125.459836] add /devices/pci0000:00/0000:00:12.2/usb1/1-1/1-1.4/1-1.4.4/1-1.4.4:1.0 (usb)
UDEV [23125.461644] add /devices/pci0000:00/0000:00:12.2/usb1/1-1/1-1.4/1-1.4.4/1-1.4.4:1.0/usbmisc/hiddev1 (usbmisc)
UDEV [23125.462031] add /devices/pci0000:00/0000:00:12.2/usb1/1-1/1-1.4/1-1.4.4/1-1.4.4:1.0/0003:04D8:003C.0006 (hid)
UDEV [23125.463362] add /devices/pci0000:00/0000:00:12.2/usb1/1-1/1-1.4/1-1.4.4/1-1.4.4:1.0/0003:04D8:003C.0006/hidraw/hidraw3 (hidraw)
It seems 4 different views of the device.
Then testing each of them four with “udevadm test”, the only place where I can see something about /dev/bus/usb is here
andromeda:/home/fernando # udevadm test /devices/pci0000:00/0000:00:12.2/usb1/1-1/1-1.4/1-1.4.4
calling: test
version 208
........
MODE 0664 /usr/lib/udev/rules.d/50-udev-default.rules:36
PROGRAM '/usr/lib/udev/mtp-probe /sys/devices/pci0000:00/0000:00:12.2/usb1/1-1/1-1.4/1-1.4.4 1 9' /usr/lib/udev/rules.d/69-libmtp.rules:1381
starting '/usr/lib/udev/mtp-probe /sys/devices/pci0000:00/0000:00:12.2/usb1/1-1/1-1.4/1-1.4.4 1 9'
'/usr/lib/udev/mtp-probe /sys/devices/pci0000:00/0000:00:12.2/usb1/1-1/1-1.4/1-1.4.4 1 9' [17083] exit with return code 0
GROUP 100 /etc/udev/rules.d/80-microchip.rules:2
MODE 0660 /etc/udev/rules.d/80-microchip.rules:2
LINK 'hidbl-1-1.4.4' /etc/udev/rules.d/80-microchip.rules:2
MODE 0666 /etc/udev/rules.d/z010_mchp_tools.rules:16
RUN '%E{hotplugscript} add' /etc/udev/rules.d/z010_mchp_tools.rules:16
handling device node '/dev/bus/usb/001/009', devnum=c189:8, mode=0666, uid=0, gid=100
preserve permissions /dev/bus/usb/001/009, 020666, uid=0, gid=100
preserve already existing symlink '/dev/char/189:8' to '../bus/usb/001/009'
found 'c189:8' claiming '/run/udev/links/\x2fhidbl-1-1.4.4'
creating link '/dev/hidbl-1-1.4.4' to '/dev/bus/usb/001/009'
preserve already existing symlink '/dev/hidbl-1-1.4.4' to 'bus/usb/001/009'
ACTION=add
BUSNUM=001
DEVLINKS=/dev/hidbl-1-1.4.4
DEVNAME=/dev/bus/usb/001/009
DEVNUM=009
DEVPATH=/devices/pci0000:00/0000:00:12.2/usb1/1-1/1-1.4/1-1.4.4
DEVTYPE=usb_device
DRIVER=usb
ID_BUS=usb
ID_MODEL=USB_HID_Bootloader
ID_MODEL_ENC=USB\x20HID\x20Bootloader
ID_MODEL_ID=003c
ID_REVISION=0002
ID_SERIAL=Microchip_Technology_Inc._USB_HID_Bootloader
ID_USB_INTERFACES=:030000:
ID_VENDOR=Microchip_Technology_Inc.
ID_VENDOR_ENC=Microchip\x20Technology\x20Inc.
ID_VENDOR_FROM_DATABASE=Microchip Technology, Inc.
ID_VENDOR_ID=04d8
MAJOR=189
MINOR=8
PRODUCT=4d8/3c/2
SUBSYSTEM=usb
TYPE=0/0/0
USEC_INITIALIZED=23125446733
hotplugscript=/etc/.mplab_ide/mchplinusbdevice
run: '/etc/.mplab_ide/mchplinusbdevice add'
unload module index
Which refers to /dev/bus/usb/001/009. And actually /dev/bus/usb/001/009. has the right permissions
andromeda:/home/fernando # ls -l /dev/bus/usb/001/009
crw-rw-rw- 1 root users 189, 8 ene 28 15:50 /dev/bus/usb/001/009
I’ve been testing to change permissions to all decives under /dev/bus/usb/001 and I always selected the right one in the last place, so I’ve thought It’s too much even for Murphy’s law and I’ve realizaed that it is necesary havving write permissions over ALL devices under /dev/bus/usb/001
Now I does not work
andromeda:/home/fernando # ls -l /dev/bus/usb/001
total 0
crw-rw-rw- 1 root root 189, 0 ene 28 08:58 001
crw-rw-rw- 1 root root 189, 1 ene 28 08:58 002
crw-rw-rw- 1 root root 189, 3 ene 28 08:58 004
crw-rw-r-- 1 root root 189, 5 ene 28 08:58 006
crw-rw-rw- 1 root root 189, 6 ene 28 08:58 007
crw-rw-rw- 1 root users 189, 8 ene 28 15:50 009
Now It does work
andromeda:/home/fernando # ls -l /dev/bus/usb/001
total 0
crw-rw-rw- 1 root root 189, 0 ene 28 08:58 001
crw-rw-rw- 1 root root 189, 1 ene 28 08:58 002
crw-rw-rw- 1 root root 189, 3 ene 28 08:58 004
crw-rw-rw- 1 root root 189, 5 ene 28 08:58 006
crw-rw-rw- 1 root root 189, 6 ene 28 08:58 007
crw-rw-rw- 1 root users 189, 8 ene 28 15:50 009
andromeda:/home/fernando #
So I would need to change udev rules to change permissions to all devices under /dev/bus/usb/001 at once, but I don’t know how.
This would appear to be where things are being set…
–
Cheers Malcolm °¿° SUSE Knowledge Partner (Linux Counter #276890)
openSUSE 13.1 (Bottle) (x86_64) GNOME 3.10.2 Kernel 3.11.6-4-desktop
If you find this post helpful and are logged into the web interface,
please show your appreciation and click on the star below… Thanks!
Then I’ve done the opposite: I comment my rule and keep z010_mchp_tools.rules
THen more or less the same, except /dev/bus/usb/001/014 is not set to my group, but is set rw to everybody, and simlynk dos not appear but it work the same: as root or changin permissions to all devices under /dev/bus/usb/001
andromeda:/home/fernando # ls -l /dev/bus/usb/001
total 0
crw-rw-r-- 1 root root 189, 0 ene 28 08:58 001
crw-rw-r-- 1 root root 189, 1 ene 28 08:58 002
crw-rw-r-- 1 root root 189, 3 ene 28 08:58 004
crw-rw-r-- 1 root root 189, 5 ene 28 08:58 006
crw-rw-r-- 1 root root 189, 6 ene 28 08:58 007
crw-rw-rw- 1 root root 189, 13 ene 28 20:44 014
I wonder if all devices under /dev/bus/usb/001 are owned by the card but only /dev/bus/usb/001/014 dissapears when i unplug it.