Re: New multi-use device
"Krakora, Robert V" <[email protected]>
| Newsgroups | gmane.linux.usb.devel |
|---|---|
| Message-ID | <3C747ACCF572D44494F0A8C8183CAA6CD3C292@USINKOK-EX11.NorthAmerica.DelphiAuto.net> |
Peter: Use libusb. www.totalphase.com makes devices similar to the one that you are developing and they use libusb for Linux and libusb_win32 for Windows. usb_set_configuration() will allow you to switch USB configurations. I use it with libusb_win32 for the iPod application that I wrote to switch the iPod from MSC mode to iAP mode to have a Windows PC emulate an iPod accessory to command the iPod to stream audio PCM data over USB after authenticating. Best Regards, Rob Krakora Software Engineer Delphi Electronics & Safety e-mail: [email protected] phone: 765-451-8574 -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Stephens, Peter A. Sent: Friday, October 26, 2007 1:40 PM To: [email protected] Subject: [linux-usb-devel] New multi-use device 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 **************************************************************************************** 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