* need help with my first device driver
@ 2011-04-29 9:40 Prashant Shah
2011-04-29 15:21 ` Greg KH
0 siblings, 1 reply; 4+ messages in thread
From: Prashant Shah @ 2011-04-29 9:40 UTC (permalink / raw)
To: kernelnewbies
Hi,
I am trying to write a comedi (drivers/staging/comedi) based driver
for the National Instruments USB 6008 USB based data acquisition card.
I have created a basic but more simpler structure for the drivers
based on usbdux driver which are already present. I have got to the
point where the device is detected and drivers are loaded. The
/dev/comedi0 device file is created. I am unable to deal with the data
transfer. When I try to run xoscope that is used to read the output
from the card - the card freezes (the status lights stop blinking).
Output from the lsusb :
https://github.com/prashants/temptest/blob/8e81e7fb4ea260fa24e68f43c185d768aec48023/device.txt
Source of the driver :
https://github.com/prashants/temptest/blob/8e81e7fb4ea260fa24e68f43c185d768aec48023/drivers/ni_usb6008.c
Device : http://sine.ni.com/nips/cds/view/p/lang/en/nid/201986
I am not interested in the digital input/output and analog output at
this point. My main concern is the ability to read the analog input.
----------------------------------------------------
Apr 29 14:56:43 prashant kernel: [ 1503.900700] usb 2-1.2: new full
speed USB device using ehci_hcd and address 6
Apr 29 14:56:43 prashant kernel: [ 1504.172214] comedi: version 0.7.76
- http://www.comedi.org
Apr 29 14:56:43 prashant kernel: [ 1504.174688] comedi: ni_usb6008:
init_ni_usb6008
Apr 29 14:56:43 prashant kernel: [ 1504.174692] ni_usb6008:
v2.4:Stirling/ITL USB-DUX -- Bernd.Porr at f2s.com
Apr 29 14:56:43 prashant kernel: [ 1504.174708] comedi: ni_usb6008:
ni_usb6008_probe
Apr 29 14:56:43 prashant kernel: [ 1504.174711] comedi_: ni_usb6008_:
finding a free structure for the usb-device
Apr 29 14:56:43 prashant kernel: [ 1504.174959] comedi0: ni_usb6008:
has been successfully initialised.
Apr 29 14:56:43 prashant kernel: [ 1504.174990] usbcore: registered
new interface driver ni_usb6008
Apr 29 14:56:43 prashant kernel: [ 1504.176558] comedi: ni_usb6008:
ni_usb6008_firmware_request_complete_handler
Apr 29 14:56:43 prashant kernel: [ 1504.176592] comedi: ni_usb6008:
ni_usb6008_attach
Apr 29 14:56:43 prashant kernel: [ 1504.176593] comedi0: ni_usb6008 0
is attached to comedi.
Apr 29 14:56:43 prashant kernel: [ 1504.176595] comedi0: ni_usb6008:
attached to ni_usb6008.
Apr 29 14:56:43 prashant kernel: [ 1504.176634] comedi_: ni_usb6008_:
comedi_usb_auto_config: 0
Apr 29 14:56:47 prashant kernel: [ 1508.563459] comedi: ni_usb6008:
ni_usb6008_ai_cmdtest
Apr 29 14:56:47 prashant kernel: [ 1508.563466] comedi: ni_usb6008:
ni_usb6008_ai_cmdtest
Apr 29 14:56:47 prashant kernel: [ 1508.563468] comedi: ni_usb6008:
ni_usb6008_ai_cmdtest
Apr 29 14:56:47 prashant kernel: [ 1508.563474] comedi: ni_usb6008:
ni_usb6008_ai_cmdtest
Apr 29 14:56:47 prashant kernel: [ 1508.563475] comedi: ni_usb6008:
ni_usb6008_ai_cmd
Apr 29 14:56:47 prashant kernel: [ 1508.563477] comedi0: ni_usb6008:
sending commands to the usb device: size=8
Apr 29 14:56:47 prashant kernel: [ 1508.563478] comedi: ni_usb6008:
send_dux_commands
Apr 29 14:56:47 prashant kernel: [ 1508.563631] comedi: ni_usb6008:
ni_usb6008_submit_InURBs
Apr 29 14:56:47 prashant kernel: [ 1508.563983] comedi: ni_usb6008:
ni_usb6008_ai_cancel
Apr 29 14:56:47 prashant kernel: [ 1508.563985] comedi: ni_usb6008:
ni_usb6008_ai_stop
Apr 29 14:56:47 prashant kernel: [ 1508.563986] comedi: ni_usb6008:
ni_usb6008_unlink_InURBs
Apr 29 14:56:47 prashant kernel: [ 1508.573486] comedi: ni_usb6008:
ni_usb6008_ai_IsocIrq
Apr 29 14:56:47 prashant kernel: [ 1508.573490] comedi0: ni_usb6008: unlinking.
Apr 29 14:56:47 prashant kernel: [ 1508.573492] comedi: ni_usb6008:
ni_usb6008_ai_stop
Apr 29 14:56:47 prashant kernel: [ 1508.573514] comedi: ni_usb6008:
ni_usb6008_ai_cmdtest
Apr 29 14:56:47 prashant kernel: [ 1508.573517] comedi: ni_usb6008:
ni_usb6008_ai_cmdtest
Apr 29 14:56:47 prashant kernel: [ 1508.573520] comedi: ni_usb6008:
ni_usb6008_ai_cmdtest
Apr 29 14:56:47 prashant kernel: [ 1508.573524] comedi: ni_usb6008:
ni_usb6008_ai_cmdtest
Apr 29 14:56:47 prashant kernel: [ 1508.573526] comedi: ni_usb6008:
ni_usb6008_ai_cmd
Apr 29 14:56:47 prashant kernel: [ 1508.573528] comedi0: ni_usb6008:
sending commands to the usb device: size=8
Apr 29 14:56:47 prashant kernel: [ 1508.573530] comedi: ni_usb6008:
send_dux_commands
Apr 29 14:56:47 prashant kernel: [ 1508.573750] comedi: ni_usb6008:
ni_usb6008_submit_InURBs
Apr 29 14:56:47 prashant kernel: [ 1508.583433] comedi: ni_usb6008:
ni_usb6008_ai_IsocIrq
Apr 29 14:56:47 prashant kernel: [ 1508.583435] comedi0: ni_usb6008:
copying data to transfer_buffer
Apr 29 14:56:47 prashant kernel: [ 1508.585428] comedi: ni_usb6008:
ni_usb6008_ai_IsocIrq
Apr 29 14:56:47 prashant kernel: [ 1508.585431] comedi0: ni_usb6008:
copying data to transfer_buffer
Apr 29 14:56:47 prashant kernel: [ 1508.587422] comedi: ni_usb6008:
ni_usb6008_ai_IsocIrq
Apr 29 14:56:47 prashant kernel: [ 1508.587424] comedi0: ni_usb6008:
copying data to transfer_buffer
Apr 29 14:56:47 prashant kernel: [ 1508.589419] comedi: ni_usb6008:
ni_usb6008_ai_IsocIrq
Apr 29 14:56:47 prashant kernel: [ 1508.589420] comedi0: ni_usb6008:
copying data to transfer_buffer
Apr 29 14:56:47 prashant kernel: [ 1508.591427] comedi: ni_usb6008:
ni_usb6008_ai_IsocIrq
Apr 29 14:56:47 prashant kernel: [ 1508.591430] comedi0: ni_usb6008:
copying data to transfer_buffer
Apr 29 14:56:47 prashant kernel: [ 1508.593412] comedi: ni_usb6008:
ni_usb6008_ai_IsocIrq
Apr 29 14:56:47 prashant kernel: [ 1508.593414] comedi0: ni_usb6008:
copying data to transfer_buffer
Apr 29 14:56:47 prashant kernel: [ 1508.595412] comedi: ni_usb6008:
ni_usb6008_ai_IsocIrq
....
....
....
Apr 29 14:56:51 prashant kernel: [ 1512.572562] comedi0: ni_usb6008:
copying data to transfer_buffer
Apr 29 14:56:51 prashant kernel: [ 1512.574550] comedi: ni_usb6008:
ni_usb6008_ai_IsocIrq
Apr 29 14:56:51 prashant kernel: [ 1512.574552] comedi0: ni_usb6008:
copying data to transfer_buffer
Apr 29 14:56:51 prashant kernel: [ 1512.576550] comedi: ni_usb6008:
ni_usb6008_ai_IsocIrq
Apr 29 14:56:51 prashant kernel: [ 1512.576551] comedi0: ni_usb6008:
copying data to transfer_buffer
Apr 29 14:56:51 prashant kernel: [ 1512.578543] comedi: ni_usb6008:
ni_usb6008_ai_IsocIrq
Apr 29 14:56:51 prashant kernel: [ 1512.578545] comedi0: ni_usb6008:
copying data to transfer_buffer
Apr 29 14:56:51 prashant kernel: [ 1512.580543] comedi: ni_usb6008:
ni_usb6008_ai_IsocIrq
Apr 29 14:56:51 prashant kernel: [ 1512.580545] comedi0: ni_usb6008:
copying data to transfer_buffer
Apr 29 14:56:51 prashant kernel: [ 1512.581218] comedi: ni_usb6008:
ni_usb6008_ai_cancel
Apr 29 14:56:51 prashant kernel: [ 1512.581220] comedi: ni_usb6008:
ni_usb6008_ai_stop
Apr 29 14:56:51 prashant kernel: [ 1512.581221] comedi: ni_usb6008:
ni_usb6008_unlink_InURBs
Apr 29 14:56:51 prashant kernel: [ 1512.582537] comedi: ni_usb6008:
ni_usb6008_ai_IsocIrq
Apr 29 14:56:51 prashant kernel: [ 1512.582539] comedi0: ni_usb6008: unlinking.
Apr 29 14:56:51 prashant kernel: [ 1512.582541] comedi: ni_usb6008:
ni_usb6008_ai_stop
Apr 29 14:56:55 prashant kernel: [ 1515.973856] usb 2-1.2: USB
disconnect, address 6
Apr 29 14:56:55 prashant kernel: [ 1515.973922] comedi: ni_usb6008:
ni_usb6008_disconnect
Apr 29 14:56:55 prashant kernel: [ 1515.973985] comedi_: ni_usb6008:
ni_usb6008_detach
Apr 29 14:56:55 prashant kernel: [ 1515.973988] comedi0: ni_usb6008:
detach usb device
Apr 29 14:56:55 prashant kernel: [ 1515.973991] comedi0: ni_usb6008:
detach: successfully removed
Apr 29 14:56:55 prashant kernel: [ 1515.974036] comedi: ni_usb6008: tidy_up
Apr 29 14:56:55 prashant kernel: [ 1515.974040] comedi_: ni_usb6008:
disconnected from the usb
^ permalink raw reply [flat|nested] 4+ messages in thread
* need help with my first device driver
2011-04-29 9:40 need help with my first device driver Prashant Shah
@ 2011-04-29 15:21 ` Greg KH
2011-05-03 17:05 ` Prashant Shah
0 siblings, 1 reply; 4+ messages in thread
From: Greg KH @ 2011-04-29 15:21 UTC (permalink / raw)
To: kernelnewbies
On Fri, Apr 29, 2011 at 03:10:53PM +0530, Prashant Shah wrote:
> Hi,
>
> I am trying to write a comedi (drivers/staging/comedi) based driver
> for the National Instruments USB 6008 USB based data acquisition card.
>
> I have created a basic but more simpler structure for the drivers
> based on usbdux driver which are already present. I have got to the
> point where the device is detected and drivers are loaded. The
> /dev/comedi0 device file is created. I am unable to deal with the data
> transfer. When I try to run xoscope that is used to read the output
> from the card - the card freezes (the status lights stop blinking).
>
> Output from the lsusb :
> https://github.com/prashants/temptest/blob/8e81e7fb4ea260fa24e68f43c185d768aec48023/device.txt
> Source of the driver :
> https://github.com/prashants/temptest/blob/8e81e7fb4ea260fa24e68f43c185d768aec48023/drivers/ni_usb6008.c
> Device : http://sine.ni.com/nips/cds/view/p/lang/en/nid/201986
>
> I am not interested in the digital input/output and analog output at
> this point. My main concern is the ability to read the analog input.
I would recommend asking this on the comedi mailing list.
But, I would really not recommend writing a new driver for the comedi
subsystem, instead, look at the iio subsystem, which is what I want to
move the comedi drivers over to once it settles down. There is an
active developer community for the drivers, and a subsystem maintainer,
and people should be able to give you lots of help with your code if you
post it to their list and ask for help (hint, post the code, not a link
to the code so it can be reviewed in-line.)
Good luck,
greg k-h
^ permalink raw reply [flat|nested] 4+ messages in thread
* need help with my first device driver
2011-04-29 15:21 ` Greg KH
@ 2011-05-03 17:05 ` Prashant Shah
2011-05-03 17:22 ` Greg KH
0 siblings, 1 reply; 4+ messages in thread
From: Prashant Shah @ 2011-05-03 17:05 UTC (permalink / raw)
To: kernelnewbies
On Fri, Apr 29, 2011 at 8:51 PM, Greg KH <greg@kroah.com> wrote:
> On Fri, Apr 29, 2011 at 03:10:53PM +0530, Prashant Shah wrote:
>> Hi,
>>
>> I am trying to write a comedi (drivers/staging/comedi) based driver
>> for the National Instruments USB 6008 USB based data acquisition card.
>>
I want to ask a quick question on USB.
When I do a lsusb on the device it shows it has 4 end points (two bulk
in and two bulk out). How do I send commands to the device since there
are no control endpoints ? What I am doing currently is creating a
bulk receive pipe and trying to read data in the completion handler
but I dont get any data.
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
idVendor 0x3923 National Instruments Corp.
idProduct 0x717a
bcdDevice 1.03
iManufacturer 1 National Instruments
iProduct 2 NI USB-6008
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 46
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0x80
(Bus Powered)
MaxPower 500mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 4
bInterfaceClass 0 (Defined at Interface level)
bInterfaceSubClass 0
bInterfaceProtocol 0
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 5
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x01 EP 1 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 5
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x82 EP 2 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 5
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x02 EP 2 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 5
Device Status: 0x0000
(Bus Powered)
^ permalink raw reply [flat|nested] 4+ messages in thread* need help with my first device driver
2011-05-03 17:05 ` Prashant Shah
@ 2011-05-03 17:22 ` Greg KH
0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2011-05-03 17:22 UTC (permalink / raw)
To: kernelnewbies
On Tue, May 03, 2011 at 10:35:02PM +0530, Prashant Shah wrote:
> On Fri, Apr 29, 2011 at 8:51 PM, Greg KH <greg@kroah.com> wrote:
> > On Fri, Apr 29, 2011 at 03:10:53PM +0530, Prashant Shah wrote:
> >> Hi,
> >>
> >> I am trying to write a comedi (drivers/staging/comedi) based driver
> >> for the National Instruments USB 6008 USB based data acquisition card.
> >>
>
> I want to ask a quick question on USB.
>
> When I do a lsusb on the device it shows it has 4 end points (two bulk
> in and two bulk out). How do I send commands to the device since there
> are no control endpoints ?
It all depends on your device, what is the protocol for talking to your
device? Some accept commands on bulk endpoints, others on the control
one.
And there is always endpoint 0, the default control endpoint, should you
use that?
> What I am doing currently is creating a
> bulk receive pipe and trying to read data in the completion handler
> but I dont get any data.
Are you sure data is being sent? Did you ask the device to send it to
you with the correct command? Your data sheet on the device should give
you the correct information on how to get data from your device, right?
hope this helps,
greg k-h
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-05-03 17:22 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-29 9:40 need help with my first device driver Prashant Shah
2011-04-29 15:21 ` Greg KH
2011-05-03 17:05 ` Prashant Shah
2011-05-03 17:22 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).