Long description follows..... the code to review is at the end of the message.
===========
I have a device that uses interrupt OUT endpoints and I need a Linux driver. 
It seems to me that the existing USB driver stack does not support OUTPUT on 
interrupt end-points.

My device is an Ontrak ADU200 relay board that uses a Microchip PIC processor.
(if anyone is really interested: see the microchip web site for a datasheet on the
PIC16C745). The PIC16C745 does most of the USB device processing in the 
silicon circuitry of the chip.
The Microchip PIC processor does not support bulk end-points. All USB traffic
is via control and interrupt end-points.

A company named Labjack makes a board that has a similar configuration. 
(see messages by Eric Sorton on the linux-usb-devel list)
It also appears that Jeff Baitis has similar requirements for an un-named
device.

The ADU200 works fine under that convicted monopolist's operating system. 
A user-mode DLL uses plain old read/write calls to tie an application program 
with the USB drivers. The ADU200 conforms to the Chapter 9 USB spec which 
does not require devices to have a bulk end-point. 

I built an experimental driver for the ADU200 for the 2.5.54 Linux kernel.

First I had to disable the HID drivers because they appeared to be incapable 
of handling a device that lacks bulk end-points. The HID drivers claimed the 
ADU200 upon enumeration because it responds with a class of 3 (ie. HID class).
The only mechanism I could see for disabling the HID handling was to add my
device to the blacklist in hidcore.c  (Thanks go out to those who assisted me.)   

I cloned the usb_bulk_msg routine in message.c to create a usb_int_msg routine. 
This seemed to be the easiest way to add Interrupt Out capablity without 
breaking anything (and without understanding the USB internals)

I then built a simple driver based on the usbtest.c skeleton program.
My driver appears to operate OK but I have been unable to fully test it since
work got really busy.

I tried to port the design back to the 2.4.20 kernel but it failed miserably. 
Perhaps my entire approach is invalid. 

I have been reluctant to post my code since I expect that no one here has an
Ontrak ADU200 to test against. I would hate to post an inappropriate
design that breaks something or misleads someone (ie the afore-mentioned
Eric or Jeff).

Perhaps someone with sufficient knowledge could review the code and post
some comments. 

The code is attached below. (for discussion purposes only ..... do not use it,
it is full of ad-hoc debugging output)

The messageint.c file is basically a copy of message.c with usb_bulk_msg 
cloned as usb_int_msg. Wherever possible the helper routines are identical to 
message.c
PROBLEM: The last parameter to the usb_fill_int is the interval. Using zero
supposedly means one-shot, but this is reported as an invalid argument?
PROBLEM: copy_from_user and copy_to_user did not work for me. I had to
use the strncpy function to move the data?
NOTE: When the changes are ready I will generate a proper patch file
that incorporates the usb_int_msg routine into message.c

The ocsadu.c file is my device driver module.

The fdusb.c file is a user application to test the driver. (I did not post my
other test program that loops thru 1000 write/read cycles. The driver works
OK in this tight application loop).

   



I hope that a generic solution can be created that works for all devices needing 
USB end-points with Interrupt-Output capability.
Why? Because I am lazy.... if the testing/support is shared with the Labjack 
people then I do not have to do it all myself.

Thanks for your attention,
John Homppi


Attachment: messageint.c
Description: Binary data

Attachment: ocsadu.c
Description: Binary data

Attachment: fdusb.c
Description: Binary data

Reply via email to