Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

MayPeng

macrumors member
Original poster
Nov 21, 2010
53
0
I have a hid device , because its class is 0x03. I use HIDManager and IOServiceMatching(kIOHIDDeviceKey), both can't find device, whether the kernel don't have matching driver, and I must write a hid device driver?

Main code:
method 1:
IOHIDManagerRef mgr;

mgr = IOHIDManagerCreate(kCFAllocatorDefault, kIOHIDOptionsTypeNone);
IOHIDManagerSetDeviceDeviceMatching(mgr, NULL);
IOHIDManagerOpen(mgr, kIOHIDOptionsTypeNone);

CFSetRef device_set = IOHIDManagerCopyDevices(mgr);

CFIndex num_devices = CFSetGetCount(device_set);
....
method 2:
io_iterator_t hidObjectIterator;
CFMutableDictionaryRef hidMatchingDict= IOServiceMatching(kIOHIDDeviceKey);
//add my device pid and vid to hidMatchingDict
.....

IOServiceGetMatchingServices(,,hidObjectIterator);

io_object_t hidDevice;
while(hidDevice = IOIteratorNext(hidObjectIterator))
{...}

As a result, hidDevice = 0;
 
My device is indeed a HID device, why Hid_Explore example can't find it? To find the device what should I do? I'm very worrying and I will waiting online all the time.Anyone who helps me I will very appreciate him/her.
 
Two notes for you:

1) Why have you not told us what your device is? At least the class of device? This could at least get us to the point of knowing if we should expect the OS to have a generic HID divice driver for this class of device. If there is no generic class driver, then: yes, absolutely you will need to create a device driver (and no, it is not going to be easy).

Unless you ask good questions, you should expect nothing but bad answers.

2) This is not the sort of forum where you should expect to find people who can write drivers. This is a user-level forum. If you need help writing device drivers, then your best bet (short of paying someone who knows how to write device drivers on the Mac) is going to be on Apple's Darwin-drivers list.
 
Two notes for you:

1) Why have you not told us what your device is? At least the class of device? This could at least get us to the point of knowing if we should expect the OS to have a generic HID divice driver for this class of device. If there is no generic class driver, then: yes, absolutely you will need to create a device driver (and no, it is not going to be easy).

Unless you ask good questions, you should expect nothing but bad answers.

2) This is not the sort of forum where you should expect to find people who can write drivers. This is a user-level forum. If you need help writing device drivers, then your best bet (short of paying someone who knows how to write device drivers on the Mac) is going to be on Apple's Darwin-drivers list.

Your speaking make sense to me. Actually I don't know how to ask question properly to resolve my issue because I'm new to communicate with usb device.

The following is the info capturing through USB Probe:
Device Descriptor:
Descriptor version number: 0x0110
Device Class: 0(Composite)
Device SubClass: 0
Device Protocol: 0
Device MaxPackerSize: 64
Device VendorID/ProductID: 0X0557/0X2303
Device Version Number: 0x0001
Number of Configurations: 1
manufacturer String: 1(none)
Product String: 2(none)
Serial Number String: 0(none)

Configuration Descriptor
Length (and contents): 59
Number of Interfaces: 2
Configuration Value: 1
Attributes: 0x80(bus-powered)
MaxPower: 500ma
Interface #0 -HID
Alternate Setting 0
Number of Endpoints 1
Interface Class: 3(HID)
Interface subclass 0
Interface protocol 0
HID Descriptor
EndPoint 0x01 - Interrupt Output
Interface #1 -HID

Does the OS have a generic HID divice driver for my device? How to know?

In addition, I have posted on the apple mailing list but I haven't gotten answers till now.

Thank you very much!
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.