I've been looking around for a way to get data from my device. I got some code from a PC guy who'd written a test program in XP and he did used the following calls...
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.
ReadReport();
}
and
void CUsbhidiocDlg::ReadReport()
{
CString ByteToDisplay = "";
CString MessageToDisplay = "";
DWORD Result;
char InputReportTemp[65];
char j;
UINT i;
//Read a report from the device.
/*API call:ReadFile
'Returns: the report in InputReport.
'Requires: a device handle returned by CreateFile
'(for overlapped I/O, CreateFile must be called with FILE_FLAG_OVERLAPPED),
'the Input report length in bytes returned by HidP_GetCaps,
'and an overlapped structure whose hEvent member is set to an event object.
*/
for(i=0;i<256;i++) {
Result = ReadFile
(ReadHandle,
InputReportTemp,
Capabilities.InputReportByteLength,
&NumberOfBytesRead,
(LPOVERLAPPED) &HIDOverlapped);
I poked around in the HID programming information and found this routine
Obtains a report from the device.
Availability: Mac OS X version 10.2.3 and later.
IOReturn (*getReport) (
void * self,
IOHIDReportType reportType,
UInt32 reportID,
void * reportBuffer,
UInt32 * reportBufferSize,
UInt32 timeoutMS,
IOHIDReportCallbackFunction callback,
void * callbackTarget,
void * callbackRefcon);
Parameter Descriptions
reportType
The report type.
reportID
The report ID.
reportBuffer
Pointer to a preallocated buffer.
reportBufferSize
Size of the reportBuffer in bytes. When finished, will contain the actual size of the report.
timeoutMS
callback
If null, this method will behave synchronously.
callbackTarget
The callback target passed to the callback.
callbackRefcon
The callback refcon passed to the callback.
function result
Returns an IOReturn code.
Most of this stuff I can figure out but I'm not sure what the Report ID is in this context. Am I even on the right track? _______________________________________________
Do not post admin requests to the list. They will be ignored.
Help/Unsubscribe/Update your Subscription: