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: how to write to interrupt output pipe



Hi Anthony,

When you say "interrupt out endpoint", do you mean sending a HID report out to it? This is what we do:

int hid_send(interface, outCookie, int x) {
IOHIDEventStruct ev;
ev.type = kIOHIDElementTypeOutput;
ev.elementCookie = outCookie;
ev.value = x;
ev.timestamp.lo = 0;
ev.timestamp.hi = 0;
ev.longValueSize = 0;
ev.longValue = 0;
return (*interface) -> setElementValue(interface, outCookie, &ev, 0, 0,0,0);
}


The trickiest part is that before calling this, you need to obtain the outCookie, and there can be subtleties. In our case, we know the index of the elements and simply hardcode it:

elements = CFDictionaryGetValue(element1, CFSTR(kIOHIDElementKey));
if (!elements) { ... bad ... }
if (CFGetTypeID(elements) != CFArrayGetTypeID()) { ... bad ... }
printf("Found %d elements\n", CFArrayGetCount(elements));
// First OUT element
element1 = CFArrayGetValueAtIndex(elements, 1);
c = at(element1, CFSTR(kIOHIDElementTypeKey)); // for convenience, at() is our own wrapper around CFDictionaryGetValue()
if (c==kIOHIDElementTypeOutput) printf("Element 1 is OUTPUT\n");
hid->outCookie = at(element1, CFSTR(kIOHIDElementCookieKey));


Obviously this is only one of a number of possible ways.

Boris

Hello:
We have a USB HID device that we can access using IOHIDDeviceInterface122. We can get data from the device's interrupt in endpoint using setInterruptReportHandlerCallback. How do we send data to an interrupt out endpoint?
Can we do it using the HID interfaces, or do we need to use IOUSBInterfaceInterface?
If so, can we get this interface via our IOHIDDeviceInterface?
Or do we need to abandon IOHIDDeviceInterface, and write a codeless kext in order to use IOUSBDeviceInterface and IOUSBInterfaceInterface directly?
Thanks in advance,
Anthony


_______________________________________________
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: 
 >how to write to interrupt output pipe (From: Anthony Malizia <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.