Mailing Lists: Apple Mailing Lists

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

Re: Using getReport with a HID device...




On Apr 14, 2005, at 1:46 PM, Rob Yepez wrote:

Hi Charles,

First of all, you are using HIDOpenReportDescriptor incorrectly and in the wrong context.  This call is only available in the kernel and is incompatible with the HID Manager.  Please stick to using the APIs defined in <IOKit/hid/>.

The following code should work:

    long                    rSize = kBufferSize;
    char                    buffer[kBufferSize];
    IOReturn                ioReturnValue = kIOReturnSuccess;

//  First, open the device...

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

//

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

I modified my code to look like the above and two things happened. My computer crashes badly-grey screen w/multi-language suggestion that I hold my power button in to restart the computer and the device I'm trying to read from locks up. Here's what I know up to this point. I can find my device because I'm able to get information about the vendor, product, version, etc... After getting that information I get the hidDeviceInterface. It's possible that I made a mistake in that code. Here's the routine I use


static void MyCreateHIDDeviceInterface ( io_object_t hidDevice , IOHIDDeviceInterface ***hidDeviceInterface )
{
io_name_t className;
IOCFPlugInInterface **plugInInterface = NULL;
HRESULT plugInResult = S_OK;
SInt32 score = 0;
IOReturn ioReturnValue = kIOReturnSuccess;




ioReturnValue = IOObjectGetClass(hidDevice, className);


ioReturnValue = IOCreatePlugInInterfaceForService ( hidDevice ,
kIOHIDDeviceUserClientTypeID ,
kIOCFPlugInInterfaceID ,
&plugInInterface ,
&score );


if (ioReturnValue == kIOReturnSuccess)
{
plugInResult = (*plugInInterface)->QueryInterface ( plugInInterface ,
CFUUIDGetUUIDBytes(kIOHIDDeviceInterfaceID) ,
(LPVOID) hidDeviceInterface );
(*plugInInterface)->Release ( plugInInterface );
}
}

The value it returns for the hidDeviceInterface is non-zero, so I assumed it was good. Was I wrong? BTW, here's what USB Prober says about the device

Full Speed device @ 3 (0x18100000): ............................................. Composite device from unknown vendor
Device Descriptor
Descriptor Version Number: 0x0200
Device Class: 0 (Composite)
Device Subclass: 0
Device Protocol: 0
Device MaxPacketSize: 16
Device VendorID/ProductID: 0x15C4/0x0001 (unknown vendor)
Device Version Number: 0x0104
Number of Configurations: 1
Manufacturer String: 1 "GMA"
Product String: 0 (none)
Serial Number String: 0 (none)
Configuration Descriptor
Total Length of Descriptor: 34
Number of Interfaces: 1
Configuration Value: 1
Attributes: 0x80 (bus-powered)
MaxPower: 32 ma
Interface #0 - HID
Alternate Setting 0
Number of Endpoints 1
Interface Class: 3 (HID)
Interface Subclass; 0
Interface Protocol 0
HID Descriptor
Descriptor Version Number: 0x0110
Country Code: 0
Descriptor Count: 1
Descriptor 1
Type: 0x22 (Report Descriptor)
Length (and contents): 34
Raw Descriptor (hex) 0000: 06 A0 FF 09 A5 A1 01 09 A6 09 A7 25 80 15 7F 75
Raw Descriptor (hex) 0010: 08 95 02 B1 02 09 A9 25 80 15 7F 75 08 95 40 81
Raw Descriptor (hex) 0020: 02 C0
Parsed Report Descriptor:
Usage Page (65440)
Usage 165 (0xa5)
Collection (Application)
Usage 166 (0xa6)
Usage 167 (0xa7)
Logical Maximum......... (-128)
Logical Minimum......... (127)
Report Size............. (8)
Report Count............ (2)
Feature................. (Data, Variable, Absolute, No Wrap, Linear, Preferred State, No Null Position, Nonvolatile, Bitfield)
Usage 169 (0xa9)
Logical Maximum......... (-128)
Logical Minimum......... (127)
Report Size............. (8)
Report Count............ (64)
Input................... (Data, Variable, Absolute, No Wrap, Linear, Preferred State, No Null Position, Bitfield)
End Collection
Endpoint 0x82 - Interrupt Input
Attributes: 0x82 (IN)
Attributes: 0x03 (Interrupt)
Max Packet Size: 64
Polling Interval: 20 ms

There's no explicit Report value, unless the Type: 0x22 is the report value. Thank you very much for your help-it means a lot to me!
 _______________________________________________
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

References: 
 >Using getReport with a HID device... (From: Charles Reader <email@hidden>)
 >Re: Using getReport with a HID device... (From: Rob Yepez <email@hidden>)
 >Re: Using getReport with a HID device... (From: Charles Reader <email@hidden>)
 >Re: Using getReport with a HID device... (From: Rob Yepez <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.