UDEV rules for a usb HID bootloader

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:


andromeda:/etc/udev/rules.d # cat 20-hidbootloader.rules
SUBSYSTEM=="usb", ACTION=="add", ATTR{idVendor}=="04d8", ATTR{idProduct}=="003c", SYMLINK+="hidbl-%k", OWNER:="root", GROUP:="users", MODE:="0660"

It seems to work


andromeda:/etc/udev/rules.d # ls /dev/hidb* -l
lrwxrwxrwx 1 root root 15 ene 24 20:53 /dev/hidbl-1-1.4.4 -> bus/usb/001/016

andromeda:/etc/udev/rules.d # ls /dev/bus/usb/001/016 -l
crw-rw---- 1 root users 189, 15 ene 24 20:53 /dev/bus/usb/001/016
andromeda:/etc/udev/rules.d # 

But I can’t use the usb device either. Am I doing something wrong about UDEV?

regards

Hi
Your rule number is too low, make it 51 at a minimum. Don’t forget to run udevadm trigger after re-numbering the rule.

Else try;


SUBSYSTEM=="usb", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="003c", SYMLINK+="hidbl-%k", MODE="0666", GROUP="users"

None of them worked


andromeda:/etc/udev/rules.d # cat  90-hidbootloader.rules
#SUBSYSTEM=="usb", ACTION=="add", ATTR{idVendor}=="04d8", ATTR{idProduct}=="003c", SYMLINK+="hidbl-%k", OWNER:="root", GROUP:="users", MODE:="0660"
SUBSYSTEM=="usb", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="003c", SYMLINK+="hidbl-%k", MODE="0666", GROUP="users"


andromeda:/etc/udev/rules.d # ls -l /dev/hidb*
lrwxrwxrwx 1 root root 15 ene 24 23:25 /dev/hidbl-1-1.4.4 -> bus/usb/001/018

andromeda:/etc/udev/rules.d # ls /dev/bus/usb/001/018 -l
crw-rw-rw- 1 root users 189, 17 ene 24 23:25 /dev/bus/usb/001/018
andromeda:/etc/udev/rules.d # 



I need to ask a question - your user is a member of the ‘users’ group right?

groups

Yes, I am


fernando@andromeda:~> groups
users uucp dialout video lock
fernando@andromeda:~> 

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.

Then I try this


andromeda:/home/fernando # chgrp -R users /dev/bus/usb
andromeda:/home/fernando # chmod -R g+w  /dev/bus/usb
andromeda:/home/fernando # ls -l /dev/bus/usb/001
total 0
crw-rw-r-- 1 root users 189, 0 ene 26 10:46 001
crw-rw-r-- 1 root users 189, 1 ene 26 10:46 002
crw-rw-r-- 1 root users 189, 3 ene 26 10:46 004
crw-rw-r-- 1 root users 189, 5 ene 26 10:46 006
crw-rw-r-- 1 root users 189, 6 ene 26 10:46 007
crw-rw-rw- 1 root users 189, 7 ene 26 11:07 008
andromeda:/home/fernando # 

And It works. :open_mouth:

On Sun 26 Jan 2014 10:26:01 AM CST, fperal wrote:

Then I try this

andromeda:/home/fernando # chgrp -R users /dev/bus/usb
andromeda:/home/fernando # chmod -R g+w /dev/bus/usb
andromeda:/home/fernando # ls -l /dev/bus/usb/001
total 0
crw-rw-r-- 1 root users 189, 0 ene 26 10:46 001
crw-rw-r-- 1 root users 189, 1 ene 26 10:46 002
crw-rw-r-- 1 root users 189, 3 ene 26 10:46 004
crw-rw-r-- 1 root users 189, 5 ene 26 10:46 006
crw-rw-r-- 1 root users 189, 6 ene 26 10:46 007
crw-rw-rw- 1 root users 189, 7 ene 26 11:07 008
andromeda:/home/fernando #

And It works. :open_mouth:

Hi
Anything will work if you change ownership :wink: 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!

Sure it’s not a good solution, but I’m going insane :’(
I cant explain that:

Before plugging the device:

andromeda:~ # ls -l /dev/bus/usb/001
total 0
cr--r--r-- 1 root root 189, 0 ene 26 10:46 001
cr--r--r-- 1 root root 189, 1 ene 26 10:46 002
cr--r--r-- 1 root root 189, 3 ene 26 10:46 004
cr--r--r-- 1 root root 189, 5 ene 26 10:46 006
cr--r--r-- 1 root root 189, 6 ene 26 10:46 007


Then i plug the device in:


andromeda:~ # ls -l /dev/bus/usb/001
total 0
cr--r--r-- 1 root root  189,  0 ene 26 10:46 001
cr--r--r-- 1 root root  189,  1 ene 26 10:46 002
cr--r--r-- 1 root root  189,  3 ene 26 10:46 004
cr--r--r-- 1 root root  189,  5 ene 26 10:46 006
cr--r--r-- 1 root root  189,  6 ene 26 10:46 007
crw-rw-rw- 1 root users 189, 13 ene 26 20:16 014

andromeda:~ # ls -l /dev/hid*       
lrwxrwxrwx 1 root root     15 ene 26 20:16 /dev/hidbl-1-1.4.4 -> bus/usb/001/014
...

OK, the new device is /dev/bus/usb/001/0014, is it?

I try to program the device… error. Why? I have writting permission!!!
Then:

andromeda:~ # chmod a+w /dev/bus/usb/001/006

And I tray again to program it… no succes.

The I repeat one by one to chage permissions on all devices on /dev/usb/001

andromeda:~ # chmod a+w /dev/bus/usb/001/004

no success

andromeda:~ # chmod a+w /dev/bus/usb/001/002

no success

an finally

andromeda:~ # chmod a+w /dev/bus/usb/001/001

SUCESS!!! Why??? :dont-know::question:

Moreover, I’ve tried twice and the first time the “correct” device was 007.

Is there any hidden camera recording me???

On Sun 26 Jan 2014 07:36:01 PM CST, fperal wrote:

andromeda:~ # chmod a+w /dev/bus/usb/001/001

SUCESS!!! Why??? :dont-know::question:

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… :wink:

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!

Further to Malcolm’s suggestion.

Run

udevadm monitor

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/

That should tell you what is/isn’t working.

I plug the device in


andromeda:/home/fernando # usb-devices
........

T:  Bus=01 Lev=03 Prnt=04 Port=03 Cnt=03 Dev#=  8 Spd=12  MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
P:  Vendor=04d8 ProdID=003c Rev=00.02
S:  Manufacturer=Microchip Technology Inc.
S:  Product=USB HID Bootloader
C:  #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr=100mA
I:  If#= 0 Alt= 0 #EPs= 2 Cls=03(HID  ) Sub=00 Prot=00 Driver=usbhid

.......

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.

Hi
So what is this rule, yours was 90-?


/etc/udev/rules.d/80-microchip.rules:2

At some point I changed It’s name and number


andromeda:/home/fernando # cat /etc/udev/rules.d/80-microchip.rules
# Pinguino32 (PIC32MX)
ATTR{idVendor}=="04d8", ATTR{idProduct}=="003c", MODE="0660",GROUP="users", SYMLINK+="hidbl-%k"

andromeda:/home/fernando # 



On Tue 28 Jan 2014 04:16:02 PM CST, fperal wrote:

malcolmlewis;2620088 Wrote:
> Hi
> So what is this rule, yours was 90-?
> >
Code:

> >
> /etc/udev/rules.d/80-microchip.rules:2
>

> >

At some point I changed It’s name and number

Code:

andromeda:/home/fernando # cat /etc/udev/rules.d/80-microchip.rules

Pinguino32 (PIC32MX)

ATTR{idVendor}==“04d8”, ATTR{idProduct}==“003c”,
MODE=“0660”,GROUP=“users”, SYMLINK+=“hidbl-%k”
andromeda:/home/fernando #


Hi
Ahh ok,
So what is this one then;


add' /etc/udev/rules.d/z010_mchp_tools.rules

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!

It is other udev rule for different tools from the same vendor (Microchip)


andromeda:/home/fernando # cat /etc/udev/rules.d/z010_mchp_tools.rules
# 2012.01.23 Changed SYSFS reference(s) to ATTR.
# 2011.12.15 Note: Reboot works on all systems to have rules file recognized.
# 2010.01.26 Add reference to "usb" for Ubuntu.
# 2010.01.22 Attempt to further simplify rules files requirements.
# 2009.08.18 Rules file simplified.
# 2009.07.15 Rules file created.

ENV{hotplugscript}="/etc/.mplab_ide/mchplinusbdevice"

ACTION!="add", GOTO="check_remove"
SUBSYSTEM=="usb_device", GOTO="check_add"
SUBSYSTEM!="usb", GOTO="rules_end"

LABEL="check_add"

ATTR{idVendor}=="04d8", MODE="666", RUN+="%E{hotplugscript} add"
GOTO="rules_end"

LABEL="check_remove"

ACTION=="remove", RUN+="%E{hotplugscript} remove %E{PRODUCT}"

LABEL="rules_end"


It runs a binary program.


andromeda:/home/fernando # ls /etc/.mplab_ide/
libUSBAccessLink.so  mchpdefport  mchplinusbdevice
andromeda:/home/fernando # ls /etc/.mplab_ide/ -l
total 148
-rw-r--r-- 1 root root 145086 oct 11  2010 libUSBAccessLink.so
-rwxr--r-- 1 root root     16 oct 15  2010 mchpdefport
lrwxrwxrwx 1 root root     44 oct 13 01:26 mchplinusbdevice -> /opt/microchip/mplabcomm1.0/mchplinusbdevice


andromeda:/home/fernando # cat /etc/.mplab_ide/mchpdefport
localhost
30000

But I’ve disabled It (I’ve commented all the lines in the script) and the system behaves the same way

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[41832.481624] add      /devices/pci0000:00/0000:00:12.2/usb1/1-1/1-1.4/1-1.4.4 (usb)
KERNEL[41832.481700] 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[41832.482767] 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.000A (hid)
KERNEL[41832.483521] 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[41832.483693] 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.000A/hidraw/hidraw3 (hidraw)
UDEV  [41832.488579] add      /devices/pci0000:00/0000:00:12.2/usb1/1-1/1-1.4/1-1.4.4 (usb)
UDEV  [41832.490241] 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  [41832.492309] 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.000A (hid)
UDEV  [41832.492573] 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  [41832.493331] 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.000A/hidraw/hidraw3 (hidraw)
andromeda:/home/fernando # ls -l /dev/hidbl*
lrwxrwxrwx 1 root root 15 ene 28 20:35 /dev/hidbl-1-1.4.4 -> bus/usb/001/013
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
This program is for debugging only, it does not run any program
specified by a RUN key. It may show incorrect results, because
some values may be different, or not available at a simulation run.

=== trie on-disk ===
tool version:          208
file size:         5968387 bytes
header size             80 bytes
strings            1302251 bytes
nodes              4666056 bytes
load module index
read rules file: /usr/lib/udev/rules.d/10-dm.rules
read rules file: /etc/udev/rules.d/10-gr-fcdproplus.rules
read rules file: /etc/udev/rules.d/10-osmosdr.rules
read rules file: /run/udev/rules.d/10-root-symlink.rules
read rules file: /etc/udev/rules.d/10-rtl-sdr.rules
read rules file: /etc/udev/rules.d/10-usrp-uhd.rules
read rules file: /usr/lib/udev/rules.d/11-dm-lvm.rules
read rules file: /usr/lib/udev/rules.d/13-dm-disk.rules
read rules file: /usr/lib/udev/rules.d/40-usb-media-players.rules
read rules file: /usr/lib/udev/rules.d/40-usb_modeswitch.rules
read rules file: /usr/lib/udev/rules.d/42-usb-hid-pm.rules
read rules file: /usr/lib/udev/rules.d/45-isdn.rules
read rules file: /usr/lib/udev/rules.d/50-euvccam.rules
read rules file: /usr/lib/udev/rules.d/50-firmware.rules
read rules file: /usr/lib/udev/rules.d/50-udev-default.rules
read rules file: /usr/lib/udev/rules.d/51-android.rules
read rules file: /usr/lib/udev/rules.d/51-lirc.rules
read rules file: /etc/udev/rules.d/52-digilent-usb.rules
unknown key 'SYSFS{idVendor}' in /etc/udev/rules.d/52-digilent-usb.rules:34
invalid rule '/etc/udev/rules.d/52-digilent-usb.rules:34'
unknown key 'SYSFS{idVendor}' in /etc/udev/rules.d/52-digilent-usb.rules:35
invalid rule '/etc/udev/rules.d/52-digilent-usb.rules:35'
read rules file: /etc/udev/rules.d/52-hackrf.rules
specified group 'plugdev' unknown
read rules file: /usr/lib/udev/rules.d/55-Argyll.rules
read rules file: /etc/udev/rules.d/55-libsane.rules
read rules file: /usr/lib/udev/rules.d/56-idedma.rules
read rules file: /etc/udev/rules.d/56-sane-backends-autoconfig.rules
read rules file: /usr/lib/udev/rules.d/60-cdrom_id.rules
read rules file: /usr/lib/udev/rules.d/60-keyboard.rules
read rules file: /etc/udev/rules.d/60-libpisock.rules
read rules file: /usr/lib/udev/rules.d/60-persistent-alsa.rules
read rules file: /usr/lib/udev/rules.d/60-persistent-input.rules
read rules file: /usr/lib/udev/rules.d/60-persistent-serial.rules
read rules file: /usr/lib/udev/rules.d/60-persistent-storage-tape.rules
read rules file: /usr/lib/udev/rules.d/60-persistent-storage.rules
read rules file: /usr/lib/udev/rules.d/60-persistent-v4l.rules
read rules file: /usr/lib/udev/rules.d/61-accelerometer.rules
read rules file: /usr/lib/udev/rules.d/61-msft.rules
read rules file: /usr/lib/udev/rules.d/63-md-raid-arrays.rules
read rules file: /usr/lib/udev/rules.d/64-btrfs.rules
read rules file: /usr/lib/udev/rules.d/64-md-raid-assembly.rules
read rules file: /usr/lib/udev/rules.d/65-xorg-wacom.rules
read rules file: /usr/lib/udev/rules.d/69-cd-sensors.rules
read rules file: /usr/lib/udev/rules.d/69-dm-lvm-metad.rules
read rules file: /usr/lib/udev/rules.d/69-libmtp.rules
read rules file: /usr/lib/udev/rules.d/69-xorg-vmmouse.rules
read rules file: /usr/lib/udev/rules.d/70-infrared.rules
read rules file: /etc/udev/rules.d/70-kpartx.rules
read rules file: /etc/udev/rules.d/70-persistent-cd.rules
read rules file: /etc/udev/rules.d/70-persistent-net.rules
read rules file: /usr/lib/udev/rules.d/70-power-switch.rules
read rules file: /usr/lib/udev/rules.d/70-printers.rules
read rules file: /usr/lib/udev/rules.d/70-uaccess.rules
read rules file: /usr/lib/udev/rules.d/70-udev-acl.rules
read rules file: /etc/udev/rules.d/71-kpartx-compat.rules
read rules file: /usr/lib/udev/rules.d/71-seat.rules
read rules file: /usr/lib/udev/rules.d/73-seat-late.rules
read rules file: /usr/lib/udev/rules.d/73-seat-numlock.rules
read rules file: /usr/lib/udev/rules.d/75-net-description.rules
read rules file: /usr/lib/udev/rules.d/75-probe_mtd.rules
read rules file: /usr/lib/udev/rules.d/75-tty-description.rules
read rules file: /usr/lib/udev/rules.d/77-mm-ericsson-mbm.rules
read rules file: /usr/lib/udev/rules.d/77-mm-huawei-net-port-types.rules
read rules file: /usr/lib/udev/rules.d/77-mm-longcheer-port-types.rules
read rules file: /usr/lib/udev/rules.d/77-mm-nokia-port-types.rules
read rules file: /usr/lib/udev/rules.d/77-mm-pcmcia-device-blacklist.rules
read rules file: /usr/lib/udev/rules.d/77-mm-platform-serial-whitelist.rules
read rules file: /usr/lib/udev/rules.d/77-mm-simtech-port-types.rules
read rules file: /usr/lib/udev/rules.d/77-mm-usb-device-blacklist.rules
read rules file: /usr/lib/udev/rules.d/77-mm-usb-serial-adapters-greylist.rules
read rules file: /usr/lib/udev/rules.d/77-mm-x22x-port-types.rules
read rules file: /usr/lib/udev/rules.d/77-mm-zte-port-types.rules
read rules file: /usr/lib/udev/rules.d/77-network.rules
read rules file: /usr/lib/udev/rules.d/77-nm-olpc-mesh.rules
read rules file: /usr/lib/udev/rules.d/78-sound-card.rules
read rules file: /usr/lib/udev/rules.d/80-drivers.rules
read rules file: /usr/lib/udev/rules.d/80-hotplug-cpu-mem.rules
read rules file: /etc/udev/rules.d/80-microchip.rules
read rules file: /usr/lib/udev/rules.d/80-mm-candidate.rules
read rules file: /usr/lib/udev/rules.d/80-net-name-slot.rules
read rules file: /usr/lib/udev/rules.d/80-udisks2.rules
read rules file: /usr/lib/udev/rules.d/81-mount.rules
read rules file: /usr/lib/udev/rules.d/85-regulatory.rules
read rules file: /usr/lib/udev/rules.d/85-usbmuxd.rules
read rules file: /usr/lib/udev/rules.d/90-alsa-restore.rules
read rules file: /usr/lib/udev/rules.d/90-libgpod.rules
read rules file: /usr/lib/udev/rules.d/90-pulseaudio.rules
read rules file: /usr/lib/udev/rules.d/95-cd-devices.rules
read rules file: /usr/lib/udev/rules.d/95-dm-notify.rules
read rules file: /usr/lib/udev/rules.d/95-udev-late.rules
read rules file: /usr/lib/udev/rules.d/95-upower-battery-recall-dell.rules
read rules file: /usr/lib/udev/rules.d/95-upower-battery-recall-fujitsu.rules
read rules file: /usr/lib/udev/rules.d/95-upower-battery-recall-gateway.rules
read rules file: /usr/lib/udev/rules.d/95-upower-battery-recall-ibm.rules
read rules file: /usr/lib/udev/rules.d/95-upower-battery-recall-lenovo.rules
read rules file: /usr/lib/udev/rules.d/95-upower-battery-recall-toshiba.rules
read rules file: /usr/lib/udev/rules.d/95-upower-csr.rules
read rules file: /usr/lib/udev/rules.d/95-upower-hid.rules
read rules file: /usr/lib/udev/rules.d/95-upower-wup.rules
read rules file: /usr/lib/udev/rules.d/97-hid2hci.rules
read rules file: /etc/udev/rules.d/98-avrdude.rules
read rules file: /etc/udev/rules.d/99-iwlwifi-led.rules
read rules file: /usr/lib/udev/rules.d/99-systemd.rules
read rules file: /etc/udev/rules.d/z010_mchp_tools.rules
rules contain 393216 bytes tokens (32768 * 12 bytes), 38377 bytes strings
24419 strings (207910 bytes), 21080 de-duplicated (172873 bytes), 3340 trie nodes used
IMPORT builtin 'usb_id' /usr/lib/udev/rules.d/50-udev-default.rules:9
IMPORT builtin 'hwdb' /usr/lib/udev/rules.d/50-udev-default.rules:9
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 13' /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 13'
'/usr/lib/udev/mtp-probe /sys/devices/pci0000:00/0000:00:12.2/usb1/1-1/1-1.4/1-1.4.4 1 13' [22047] 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
handling device node '/dev/bus/usb/001/013', devnum=c189:12, mode=0660, uid=0, gid=100
preserve permissions /dev/bus/usb/001/013, 020660, uid=0, gid=100
preserve already existing symlink '/dev/char/189:12' to '../bus/usb/001/013'
found 'c189:12' claiming '/run/udev/links/\x2fhidbl-1-1.4.4'
creating link '/dev/hidbl-1-1.4.4' to '/dev/bus/usb/001/013'
preserve already existing symlink '/dev/hidbl-1-1.4.4' to 'bus/usb/001/013'
ACTION=add
BUSNUM=001
DEVLINKS=/dev/hidbl-1-1.4.4
DEVNAME=/dev/bus/usb/001/013
DEVNUM=013
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=12
PRODUCT=4d8/3c/2
SUBSYSTEM=usb
TYPE=0/0/0
USEC_INITIALIZED=41832480660
unload module index

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.

I have found the problem:

I was pluging the device to a usb hub.

Pluging it to another usb (a usb3 pic-E card)

before plugging the card in


andromeda:~# ls /dev/bus/usb/003 -l
total 0
crw-rw-r-- 1 root root 189, 256 ene 28 08:58 001


After plugging the card in


andromeda:~ # ls /dev/bus/usb/003 -l
total 0
crw-rw-r-- 1 root root 189, 256 ene 28 08:58 001
crw-rw-rw- 1 root root 189, 260 ene 28 20:59 005
andromeda:~ # 

and now It works.
It seems as if when I plug the card to the hub I should have write rights to all the ports in the hub or something similar