Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Transaction timeout on getReport...



I had a chance to sit down with the developer of the USB device I'm working with at the moment yesterday evening. Some of the stuff he told me didn't make a whole lot of sense to me but I took a few notes and made some changes to my code. At this point last week, prior to updating to 10.3.9, my program would cause a kernel crash when I did a getReport. Upgrading to 10.3.9 has caused the system not to crash, so I can at least get an error code from getReport when it tries to do the read. The hardware developer told me that the device stores the data at "...endpoint 2" and not zero. This concept was somewhat new to me and I didn't see how it fit into the scheme of things. So I did a bit of experimenting. I changed the 2nd parameter of the open function from 0 to 2, which caused somewhat amazing things to happen.

He has an Ellisys USB Explorer which we plugged in between the Mac and the device, which allowed us to see what was going back and forth. My program properly got information from the device, such as the product ID, version number, etc... The code below is the part of the program which opens the device and requests the report.

OSStatus MyGetUSBData ( IOHIDDeviceInterface **hidDeviceInterface )
{
long rSize = kBufferSize;
char buffer[kBufferSize];
IOReturn ioReturnValue = kIOReturnSuccess;

// First, open the device...

ioReturnValue = (*hidDeviceInterface)->open( hidDeviceInterface , 2 );

// Now request the report-we'll sort the data out later...

ioReturnValue = (*hidDeviceInterface)->getReport (hidDeviceInterface, kIOHIDReportTypeInput, 0, buffer, &rSize, 0, nil, nil, nil);

ioReturnValue is 0xe0004051 after getReport executes. The Ellisys unit shows that my opening and request for data causes the device to dump the data as a as a series of packets, which my program appears to NAK. In the PC code the developer does this

if (DeviceDetected==TRUE)
{

// Set the report buffers so that there are enough of them to
// get all the data. We have 256x64byte packets which will be
// sent back over EP2 IN in interrupt transfers.
HidD_SetNumInputBuffers
(DeviceHandle,
256);

// Set report allows us to configure the device
// Configuration bits, Byte0:
// bit<7:6> '10' = BIST, '01' = NORMAL Operation
// bit<5:0> reserved for future use
// Configuration bits, Byte1:
// bit<7> 1=IMPERIAL, 0=METRIC
// bit<6:0> reserved for future use
Result = HidD_SetFeature
(DeviceHandle,
WriteBuffer,
Capabilities.FeatureReportByteLength);

//Get a report from the device.
//This will trigger the device to begin streaming the 16K EEPROM
//data back to the host.
Result = HidD_GetFeature
(DeviceHandle,
ReadBuffer,
Capabilities.FeatureReportByteLength);

//Read reports from the device until all data is captured.

Does getReport handle this differently, at least at the level I'm working at the moment? As you can see from his code he's setting up some input buffers (256 buffers which are 64 byes in size) and letting the PC HID software fill them. And what is causing my program to time out? Any help would be greatly appreciated-once I clear this hurdle I'll have 0.1a of my program ready for release!
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Usb mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/usb/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.