New multi-use device
"Stephens, Peter A." <[email protected]>
| Newsgroups | gmane.linux.usb.devel |
|---|---|
| Message-ID | <5060D6639BED4644B5C6B47614278BA201AC0B07@USINKOK-EX12.NorthAmerica.DelphiAuto.net> |
Guys and Gals,
I need some guidance if possible. I made a small PIC18LF2455 USB board
and I am writing a driver for it. It (will have) has the capability of
communicating in several ways (USB <-> RS232, USB<-> I2C, USB <-> SPI
and RS232 <-> I2C). It will also have snoop capabilities on a separate
USB endpoint for raw data on these communication channels. This is my
first attempt at writing a driver (or anything kernel-ish except for
compiling a custom configured kernel for that matter) in Linux.
I have gotten past many of the issues that I am sure newbies run into;
Since I use Fedora (8 Test 3) I took the time to learn how to make a
kernel rpm from source (success), I learned how to compile a kernel
module in the currently running kernel (2.6.23-6) (success), and I have
gotten to the point where I can talk to the firmware on the PIC via the
control channel with a "vendor" type message to set the mode for an LED
(on/off/blink) (success). I made a kernel with the USB debug enabled
and I am able to look at the USB traffic this way (success). I was not
able to get USBMon working (failure), but I have lsusb and a few other
tools compiled and working.
I would like to have each mode be a different configuration (some of the
modes are mutually exclusive anyway and won't work together on the PIC).
Since I have 4 modes of communications I thought it would make sense to
have 4 configurations with In/Out endpoints for communications and an In
endpoint for snooping (don't know if endpoints have to be in pairs, but
I don't think so).
I started off using the usb-skel.c code (and read a LOT of stuff on the
internet and books) to get this far, but I ran into two issues of
concern and would appreciate your comments (plus comments on any other
points you wish to throw in):
1) It looks like there are three main ways to accomplish this (USB
kernel module driver,
libusb, and gadget kernel module driver). I gather that the
gadget stuff is a subset
of the USB kernel driver type. Should I have been using this? I
really wanted to learn
about making modules and raw USB stuff so I don't want to use the
libusb approach.
2) I wanted to be able to switch configurations via an IOCTL call so
I started to add the
code for this into the device_ioctl routine and after browsing
the code for
"usb_set_configuration()" found out by reading the comments in
the code that this is
not really the best way to do it, but then what is the best way
to do this? It was
also kind of implied that if you have multiple configurations
then you should have
multiple drivers, but then how do you tell the device to use the
non-default
configuration? I don't really want the code for this at the
application level.
I can post code and other snippets you might want, but that may be
premature at this point. Thanks in advance for any comments or help...
Peter A. Stephens
[email protected]
****************************************************************************************
Note: If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by replying to the message and deleting it from your computer. Thank you.
****************************************************************************************
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel