Monday, May 6, 2013

PICkit2 User Permissions

Problem: Tried pk2cmd on a new box and got:
No PICkit 2 found.
lsusb indicated that the OS recognises it:
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 003 Device 002: ID 1bcf:053e Sunplus Innovation Technology Inc.
Bus 001 Device 003: ID 04f2:b2dc Chicony Electronics Co., Ltd
Bus 002 Device 003: ID 04ca:3006 Lite-On Technology Corp.
Bus 003 Device 003: ID 04d8:0033 Microchip Technology, Inc. PICkit2
It works fine if I sudo which indicates that it is a permission problem.
The solution is to set proper udev rules in /etc/udev/rules.d/ but I 
wasn't successful working it out. I checked another box and it appears 
that MPLABX has installed this:
/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"
Note the executable /etc/.mplab_ide/mchplinusbdevice. Things appear 
to work fine without it but the simple solution is to just install
MPLABX.

Friday, May 3, 2013

Device not managed

Problem: NetworkManager indicates 'device not managed' for eth0.

Edit /etc/NetworkManager/NetworkManager.conf:
[ifupdown]
managed=true
Restart:
# sudo service network-manager restart