1. Summary
  2. Files
  3. Support
  4. Report Spam
  5. Create account
  6. Log in

USB Port Problems

From piklab

Jump to: navigation, search

You need to have read and write access to the port (serial, parallel or USB).
Some distributions do not grant read/write access to regular users by default.
Some additional information written by Linus Walleij regarding interaction
between "libusb" and "udev"/"hotplug" is provided here.

Contents

For distributions using "hotplug" (Fedora Core 4, Ubuntu 5,...)

The following procedure may be used, to be able to connect to the ICD2/Pickit programmers
as a regular user on those distributions, using hotplug [thanks to Xiaofan Chen]:

  • Add the following to /etc/hotplug/usb.usermap:
pickit  0x0003 0x04d8 0x0032 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
pickit2 0x0003 0x04d8 0x0033 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
icd2    0x0003 0x04d8 0x8000 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
icd21   0x0003 0x04d8 0x8001 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
  • Add hotplug scripts "pickit", "pickit2", "icd2", "icd21" in /etc/hotplug:
#!/bin/bash
if [ "${ACTION}" = "add" ] && [ -f "${DEVICE}" ]
then
  echo "changing ${DEVICE}" >> /tmp/debug-hotplug
  chown root "${DEVICE}"
  chgrp microchip "${DEVICE}"
  chmod 660 "${DEVICE}"
fi
  • Create group "microchip" and add your username to this group.

For distributions using "udev" (Suse, Arch, Debian, Ubuntu,...)

http://usbpicprog.org/?page_id=13
[Thanks to Robert Currie]

  • Create file /etc/udev/rules.d/26-microchip.rules:
#Pickit 1
ATTR{idVendor}=="04d8", ATTR{idProduct}=="0032", OWNER:="root", GROUP:="microchip",MODE:="0660"
#Pickit 2
ATTR{idVendor}=="04d8", ATTR{idProduct}=="0033", OWNER:="root", GROUP:="microchip",MODE:="0660"
#Pickit3
ATTR{idVendor}=="04d8", ATTR{idProduct}=="900a", MODE="0660", GROUP="microchip"
#ICD2
ATTR{idVendor}=="04d8", ATTR{idProduct}=="8000", OWNER:="root", GROUP:="microchip",MODE:="0660"
#ICD21
ATTR{idVendor}=="04d8", ATTR{idProduct}=="8001", OWNER:="root", GROUP:="microchip",MODE:="0660"
#PICDEM FS USB Bootloader
ATTR{idVendor}=="04d8", ATTR{idProduct}=="000b", OWNER:="root", GROUP:="microchip",MODE:="0660"
  • Create a group named "microchip" and add your username to this group:
sudo addgroup microchip (for Arch Linux, it is "groupadd")
sudo gpasswd -a your_user_name microchip

For distributions using older "udev" (Debian Sid, Ubuntu 6,7,8,...)

The following procedure may be used to be able to connect to the ICD2/Pickit programmers
as a regular user on distributions using udev [thanks to David Williams]:

  • Create file /etc/udev/rules.d/26-microchip.rules:
#Pickit
SYSFS{idVendor}=="04d8", SYSFS{idProduct}=="0032", MODE="0660", GROUP="microchip"
#Pickit2
SYSFS{idVendor}=="04d8", SYSFS{idProduct}=="0033", MODE="0660", GROUP="microchip"
#Pickit3
SYSFS{idVendor}=="04d8", SYSFS{idProduct}=="900a", MODE="0660", GROUP="microchip"
#ICD2
SYSFS{idVendor}=="04d8", SYSFS{idProduct}=="8000", MODE="0660", GROUP="microchip"
#ICD21
SYSFS{idVendor}=="04d8", SYSFS{idProduct}=="8001", MODE="0660", GROUP="microchip"
  • Create a group named "microchip" and add your username to this group:
sudo addgroup microchip
sudo gpasswd -a your_user_name microchip

For distributions using "PolicyKit" (Fedora 9,10,...)

The following procedure may be used to be able to connect to the ICD2/Pickit programmers
as a regular user on distributions using udev [thanks to Xiaofan Chen]:

  • Create file /usr/share/hal/fdi/policy/10osvendor/10-microchip.fdi
<?xml version="1.0" encoding="UTF-8"?>

<deviceinfo version="0.2">
 <device>
   <!-- Microchip USB device -->
   <match key="info.subsystem" contains="usb_device">
     <match key="usb_device.vendor_id" int="0x04d8">
       <append key="info.capabilities" type="strlist">microchipusb</append>
       <append key="access_control.grant_group" type="strlist">microchip</append>
     </match>
   </match>

   <!-- Set ACLs -->
   <match key="info.capabilities" contains="microchipusb">
     <append key="info.capabilities" type="strlist">access_control</append>
     <merge key="access_control.file" type="copy_property">linux.device_file</merge>
     <merge key="access_control.type" type="string">microchipusb</merge>
   </match>
 </device>
</deviceinfo>
  • Create a group named "microchip" and add your username to this group.


For distributions using "udev" and PAM (Fedora Core 5/6,...)

The following procedure may be used to be able to connect to the ICD2/Pickit programmers
as a regular user on distribution using udev [thanks to Linus Walleij]:

  • Create file /etc/udev/rules.d/26-microchip.rules:
#PICKit
SUBSYSTEM=="usb_device", ACTION=="add", SYSFS{idVendor}=="04d8", SYSFS{idProduct}=="0032", SYMLINK+="pickit1-%k"
#PICKit2
SUBSYSTEM=="usb_device", ACTION=="add", SYSFS{idVendor}=="04d8", SYSFS{idProduct}=="0033", SYMLINK+="pickit2-%k"
#ICD2
SUBSYSTEM=="usb_device", ACTION=="add", SYSFS{idVendor}=="04d8", SYSFS{idProduct}=="8000", SYMLINK+="icd2-%k"
#ICD21
SUBSYSTEM=="usb_device", ACTION=="add", SYSFS{idVendor}=="04d8", SYSFS{idProduct}=="8001", SYMLINK+="icd2-%k"
  • Create file /etc/security/console.perms.d/pickit2.perms (and similar files for the other devices):
<pickit2>=/dev/pickit2*
<console> 0600 <pickit2> 0600 root

Additional solution for access issues

For Fedora Core in some case it helped to do the following to allow access for regular user:

create group "usbuser"
add the user to the group
add a file "11-usbuser.rules" to /etc/udev/rules.d/ that contains:
ACTION=="add", BUS=="usb", GROUP:="usbuser", MODE:="0666"
Personal tools