Can't find my HID device, whether needing to write driver?

Discussion in 'Mac Programming' started by MayPeng, Apr 19, 2011.

  1. macrumors member

    Nov 21, 2010
    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


    io_object_t hidDevice;
    while(hidDevice = IOIteratorNext(hidObjectIterator))

    As a result, hidDevice = 0;
  2. Moderator emeritus


    Jun 15, 2000
    Does it show up in HID Explorer? Handy app if you're working with HID devices/API.
  3. thread starter macrumors member

    Nov 21, 2010
    Can't show up in the HID_Explorer.Whether driver doesn't support? But my device is hid type device.
  4. thread starter macrumors member

    Nov 21, 2010
    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.
  5. macrumors 6502a

    Oct 13, 2007
    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.
  6. MayPeng, Apr 26, 2011
    Last edited: Apr 26, 2011

    thread starter macrumors member

    Nov 21, 2010
    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!

Share This Page