Yes, one can program a PIC via PICkit under LINUX 2.4.21 at least.  But 
i'm not happy with the solution i've come up with so far.  That involves 
using 'libusb-dev 0.1.7-2', searching for the device on each of the USB
buses and then accessing it via what they call 'bulk_read'/'bulk_write'.  
That necessarily requires root privileges, as i believe you can write 
anywhere on any USB device with this mechanism.  I'm not that good at
writing bug-free user level code (after 30+ years), and thus i am very 
reluctant to release code that requires SETUID.

Furthermore, when you plug the PICkit in, the 'hotplug' daemon then loads 
the HID module, which grabs the PICkit on the grounds as it's a 'pointing
device'.  So i had to 'rmmod HID' in order to access the PICkit.  Then i
lose the USB mouse (not too bad given i also have an ADB mouse for when
i have to run MacOS), and this issue i was mostly able to work around by
recompiling the kernel to use the mouse via the more primitive 'usbmouse'
module instead.  So even without the issue of requiring root privileges,
the whole thing is somewhat temperamental and not really suitable for 
general  consumption.  There's probably something you can do with the 
'hotplug' configuration files to avoid this, but it wasn't clear to me 
how to do this without careful study.

I did succeed in hacking up some example 'hiddev' code to access the
PICkit, and return its credentials, etc. (available upon request),
but not do the expected I/O.  When i looked at the kernel, i could see 
that write() was not implemented (always returns EINVAL) and i'm not 
sure at all from looking at 'hiddev.c' what read() is supposed to do. 
And without write(), it's meaningless for a PICkit.  I'm not sure
what other driver(s) to try.

Microchip no doubt chose a pointing device as a subterfuge to get
around limitations in Windows to accessing arbitrary USB devices. 
But i am not sure what the right solution for LINUX is, or what 
existing driver to extend to accomplish this in a manner that won't 
require SETUID. Any suggestions?

While it doesn't recalibrate OSCCAL or do a full memory checksum yet,
i can do most things the Windows program can do (without the annoying
[to me] graphical user interface).  It's reasonably module, decently
commented, and i'll add a GUI eventually.  But don't want to take on
responsibilty for a user program which requires root privileges, at
least, not without good reasons.
                                   -- JM

P.S. Microchip was kind enough to provide source code both for the
Windows program and for the PIC which talked to the USB port.  So
that helped in understanding how to do certain operations.


-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-users

Reply via email to