Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: UDEV rules for a usb HID bootloader

  1. #1

    Default 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.

    Code:
    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:

    Code:
    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
    Code:
    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

  2. #2
    Join Date
    Jun 2008
    Location
    Podunk
    Posts
    26,864
    Blog Entries
    15

    Default Re: UDEV rules for a usb HID bootloader

    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;
    Code:
    SUBSYSTEM=="usb", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="003c", SYMLINK+="hidbl-%k", MODE="0666", GROUP="users"
    Cheers Malcolm °¿° SUSE Knowledge Partner (Linux Counter #276890)
    SUSE SLE, openSUSE Leap/Tumbleweed (x86_64) | GNOME DE
    If you find this post helpful and are logged into the web interface,
    please show your appreciation and click on the star below... Thanks!

  3. #3

    Default Re: UDEV rules for a usb HID bootloader

    Quote Originally Posted by malcolmlewis View Post
    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;
    Code:
    SUBSYSTEM=="usb", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="003c", SYMLINK+="hidbl-%k", MODE="0666", GROUP="users"

    None of them worked


    Code:
    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 #

  4. #4
    Join Date
    Jun 2008
    Location
    Auckland, NZ
    Posts
    20,392
    Blog Entries
    1

    Default Re: UDEV rules for a usb HID bootloader

    I need to ask a question - your user is a member of the 'users' group right?
    Code:
    groups

  5. #5

    Default Re: UDEV rules for a usb HID bootloader

    Quote Originally Posted by deano_ferrari View Post
    I need to ask a question - your user is a member of the 'users' group right?
    Code:
    groups
    Yes, I am

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

  6. #6

    Default Re: UDEV rules for a usb HID bootloader

    I've found a solution, but I don't understand why It works

    Code:
    andromeda:/home/fernando # ls -l /dev/bus
    total 0
    drwxr-xr-x 11 root root 220 ene 26 10:46 usb
    Code:
    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

    Code:
    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:
    Code:
    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
    Code:
    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
    Code:
    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.

  7. #7
    Join Date
    Jun 2008
    Location
    Podunk
    Posts
    26,864
    Blog Entries
    15

    Default Re: UDEV rules for a usb HID bootloader

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

    Then I try this

    Code:
    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.


    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!


  8. #8

    Default Re: UDEV rules for a usb HID bootloader

    Quote Originally Posted by malcolmlewis View Post
    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!

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

    Before plugging the device:
    Code:
    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:
    Code:
    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:
    Code:
    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
    Code:
    andromeda:~ # chmod a+w /dev/bus/usb/001/004
    no success
    Code:
    andromeda:~ # chmod a+w /dev/bus/usb/001/002
    no success

    an finally

    Code:
    andromeda:~ # chmod a+w /dev/bus/usb/001/001
    SUCESS!!!!!!!! Why?????

    Moreover, I've tried twice and the first time the "correct" device was 007.

    Is there any hidden camera recording me????

  9. #9
    Join Date
    Jun 2008
    Location
    Podunk
    Posts
    26,864
    Blog Entries
    15

    Default Re: UDEV rules for a usb HID bootloader

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

    Code:
    andromeda:~ # chmod a+w /dev/bus/usb/001/001
    SUCESS!!!!!!!! Why?????

    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!


  10. #10
    Join Date
    Jun 2008
    Location
    Auckland, NZ
    Posts
    20,392
    Blog Entries
    1

    Default Re: UDEV rules for a usb HID bootloader

    Further to Malcolm's suggestion.

    Run
    Code:
    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
    Code:
    udevadm test <device path>
    For example
    Code:
    udevadm test /sys/devices/pci0000:00/0000:00:12.2/usb1/1-1/
    That should tell you what is/isn't working.
    Last edited by deano_ferrari; 26-Jan-2014 at 14:17.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •