Intaris
2008-08-05 15:10:09 UTC
For USB
Logging, I personally have found the (non-free) ?<a href="http://www.hhdsoftware.com/Products/home/usb-monitor.html" target="_blank">Device
Monitoring Studio</a>? (which seems to have been renamed to ?USB
Monitor?) to be of great help. Other, free programs are available
such as ?<a href="http://sourceforge.net/projects/usbsnoop/" target="_blank">Snoopy
Pro</a>?. These programs sit between the Operating system and the
device driver and records all communication.
In
the examples I will work through, I had the luxury of having a
pre-existing working driver for my target device which I could
already use in LabVIEW. This enabled me to use a USB logging
software to see exactly what was being sent to the device and what
was coming back. Since I could already control the device via
LabVIEW (Via DLL) I was relatively quickly able to pin-point which
commands were tied to which functions.
A
quick mention to the ?why? of this action if I already had a
driver. Apart from ?because I could?, I wanted the software to
run under Linux. The supplied DLL wouldn't do that..
A
sample log of a basic communication may look like the example shown
below. Entries 000050 and 000051 belong to a standard
request defined within the USB Specification used to get the Device
Descriptor (Table 9-3 on Page 250). The second pair (000052
and 000053) are custom device-specific requests which were the
target of my investigations. All data needed to implement this call
through VISA is presented in an easy-to-understand form.
000050:
Get Descriptor Request (DOWN), 09.11.2007 14:35:32.156 +33.156
Descriptor
Type: Device
Descriptor
Index: 0x0
Transfer
Buffer Size: 0x12 bytes
000051:
Control Transfer (UP), 09.11.2007 14:35:36.781 +4.625. Status:
0x00000000
Pipe
Handle: 0x88df4020
12
01 00 01 00 00 00 40 61 06 00 29 00 00 00 00
***@a..)....
00
01
..
Setup
Packet
80
06 00 01 00 00 12 00 .......
Recipient:
Device
Request
Type: Standard
Direction:
Device->Host
Request:
0x6 (GET_DESCRIPTOR)
Value:
0x100
Index:
0x0
Length:
0x12
000052:
Vendor-Specific Request (DOWN), 09.11.2007 14:35:36.781 +0.0
Destination:
Other
Reserved
Bits: 0
Request:
0x4
Value:
0x1c8
Get
0x8 bytes from the device
000053:
Control Transfer (UP), 09.11.2007 14:35:36.781 +0.0. Status:
0x00000000
Pipe
Handle: 0x88df4020
62
31 30 34 37 31 30 32
b1047102
Setup
Packet
C3
04 C8 01 00 00 08 00 Ã.È.....
Recipient:
Other
Request
Type: Vendor
Direction:
Device->Host
Request:
0x4 (Unknown)
Value:
0x1c8
Index:
0x0
Length:
0x8
The
data packets (in this case Device to Host) are shown in italicised
bold font. The setup Packet is not of interest for us at the
moment as VISA takes care of this when we give the correct
transmission parameters. The USB transmission parameters used to
initiate this transfer is shown at the bottom of each entry
(Recipient, Request type and so on). These seven parameters are
detailed enough for us to be able to implement the functionality we
require.
-Note-
I
personally got stuck at this point for quite a while trying to
implement this in LabVIEW. The information IS all in the USB
specification, but it required a lot of trial and error on my part to
get it working. I want to help others avoid thie trial and error
part by sharing with the community how I got this done.
-End
Note-.
Logging, I personally have found the (non-free) ?<a href="http://www.hhdsoftware.com/Products/home/usb-monitor.html" target="_blank">Device
Monitoring Studio</a>? (which seems to have been renamed to ?USB
Monitor?) to be of great help. Other, free programs are available
such as ?<a href="http://sourceforge.net/projects/usbsnoop/" target="_blank">Snoopy
Pro</a>?. These programs sit between the Operating system and the
device driver and records all communication.
In
the examples I will work through, I had the luxury of having a
pre-existing working driver for my target device which I could
already use in LabVIEW. This enabled me to use a USB logging
software to see exactly what was being sent to the device and what
was coming back. Since I could already control the device via
LabVIEW (Via DLL) I was relatively quickly able to pin-point which
commands were tied to which functions.
A
quick mention to the ?why? of this action if I already had a
driver. Apart from ?because I could?, I wanted the software to
run under Linux. The supplied DLL wouldn't do that..
A
sample log of a basic communication may look like the example shown
below. Entries 000050 and 000051 belong to a standard
request defined within the USB Specification used to get the Device
Descriptor (Table 9-3 on Page 250). The second pair (000052
and 000053) are custom device-specific requests which were the
target of my investigations. All data needed to implement this call
through VISA is presented in an easy-to-understand form.
000050:
Get Descriptor Request (DOWN), 09.11.2007 14:35:32.156 +33.156
Descriptor
Type: Device
Descriptor
Index: 0x0
Transfer
Buffer Size: 0x12 bytes
000051:
Control Transfer (UP), 09.11.2007 14:35:36.781 +4.625. Status:
0x00000000
Pipe
Handle: 0x88df4020
12
01 00 01 00 00 00 40 61 06 00 29 00 00 00 00
***@a..)....
00
01
..
Setup
Packet
80
06 00 01 00 00 12 00 .......
Recipient:
Device
Request
Type: Standard
Direction:
Device->Host
Request:
0x6 (GET_DESCRIPTOR)
Value:
0x100
Index:
0x0
Length:
0x12
000052:
Vendor-Specific Request (DOWN), 09.11.2007 14:35:36.781 +0.0
Destination:
Other
Reserved
Bits: 0
Request:
0x4
Value:
0x1c8
Get
0x8 bytes from the device
000053:
Control Transfer (UP), 09.11.2007 14:35:36.781 +0.0. Status:
0x00000000
Pipe
Handle: 0x88df4020
62
31 30 34 37 31 30 32
b1047102
Setup
Packet
C3
04 C8 01 00 00 08 00 Ã.È.....
Recipient:
Other
Request
Type: Vendor
Direction:
Device->Host
Request:
0x4 (Unknown)
Value:
0x1c8
Index:
0x0
Length:
0x8
The
data packets (in this case Device to Host) are shown in italicised
bold font. The setup Packet is not of interest for us at the
moment as VISA takes care of this when we give the correct
transmission parameters. The USB transmission parameters used to
initiate this transfer is shown at the bottom of each entry
(Recipient, Request type and so on). These seven parameters are
detailed enough for us to be able to implement the functionality we
require.
-Note-
I
personally got stuck at this point for quite a while trying to
implement this in LabVIEW. The information IS all in the USB
specification, but it required a lot of trial and error on my part to
get it working. I want to help others avoid thie trial and error
part by sharing with the community how I got this done.
-End
Note-.