04-10-2012 03:02 AM
Colleagues,
My old scanner doesn't work under Windows 7 (because no driver available), and I would like to wrote small utility with "direct" communicaion from LabVIEW.
I have WindowsXP Virtual Machine, where my scanner working, and I can obtain USB communication log with sniffer.
Log looks like that:
As you can see, I should send 64 bytes where first two are 0x73 0x01, then scanner will respond back with bytes 0x00 0x73 0x02 and so on.
Well, I have created USB RAW Driver with Wizard as described by NI, then I wrote simple and straight forward code:
Now the problem: data sent to my device, but nothing returned back:
In additional I've got error in VISA USB Control In:
Take a note - VISA USB Control Out executes without errors.
Can someone take a look on the screenshots and give me an idea - what is wrong?
Andrey.
04-11-2012 01:05 AM - edited 04-11-2012 01:06 AM
What I have seen - there are two attributes with errors:
Not sure if this important or not and how to avoid this...
04-11-2012 02:52 AM
Hi Andrey,
there is a difference between Raw Control and Raw Bulk.
What is the Difference Between USB Raw Control and USB Raw Bulk?
I think, it could help to change the mode from Control to Bulk.
Can VISA Read be used to read USB Interrupt Data?
I hope this helps.
04-11-2012 05:15 AM
Thanks, Alex,
there is a difference between Raw Control and Raw Bulk.
What is the Difference Between USB Raw Control and USB Raw Bulk?
As far as I can undestand, my scanner uses both types. Raw Control used for sending intitial commands (such as "set ROI coordinates" and "start scan"). Then image data transferred as Raw Bulk in several large packets. But first I should be able to send commands to scanner.
The problem is - the intial bytes should be transferred as "VENDOR_DEVICE" request (see URB_FUNCTION_VENDOR_DEVICE above). But LabVIEW seems to be supported only URB_FUNCTION_CONTROL_TRANSFER. When I try to send request as CONTROL_TRANSFER, then scanner not responding, because "VENDOR_DEVICE" is expected. Actually _URB_CONTROL_VENDOR_OR_CLASS_REQUEST and _URB_CONTROL_TRANSFER are sligthly different structures.
I tried to transfer request with VISA Write, but it was not successful (probably because two attributes has wrong property values - see screenshot above).
04-11-2012 08:05 AM
Hi Andrey
i found this, they have used a different request type
04-12-2012 06:37 PM
@Duffy2007 wrote:
i found this, they have used a different request type
Thanks, the problem was really in request type. Changed it to 0x40 for sending and to 0xC0 for receiving:
and now I have received some data from my scanner back.
Useful link: http://www.beyondlogic.org/usbnutshell/usb6.shtml
Andrey.