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: getting kUSBPipeStalledError on getReport (IOHIDTransactions)



Actually, what I've posted is the wrong half of the story for you.
IOHIDOutputTransactions is the setReport side. (Output Transactions
being reports sent to out to the device) IOHIDQueueInterface is the
getReport side. I'm pretty sure that you can use HID Queues with
setReport if you'd like. I ended up using OutputTransactions because I
felt that it was the most compatible solution.

I also looked back at my code - and it appears that
IOHIDOutputTransactions automatically adds the HID report ID to the
front of the report value - you don't need to worry about it.

So, IOHIDQueueInterface, works almost exactly analogously to
IOHIDOutputTransactions. You can share the code needed to enumerate
the HID reports for their cookies. Use kIOElementTypeInput_Misc as the
elementType during enumeration.

allocQueue
Create() // create a Queue with the specified length
addElement() // use your enumerated HID report cookie
start() // start the queue
getNextEvent() // get the next HID event in the Queue

Then, inside a thread or loop with a timeout, poll getNextEvent()
which fills out an IOHIDEventStruct with the values of the input
report. My device only speaks when spoken to, so rather than having a
dedicated thread I have a loop that calls getNextEvent with a timeout
using UpTime().

Now that I have my code finished I like the way it works. If HID
reports are added or removed from the device firmware my code takes it
all in stride. I was also able to add code to automatically select the
best-fit HID report for the particular data being sent, as my
particular device has short (20-byte), medium (64-byte), and long
(120-byte) reports available.

I agree with you that the getReport / setReport format is a lot simpler.

Mike Haboustak


On 4/13/05, Richard Scorer <email@hidden> wrote:
> MIke, thanks for your notes.
> 
> After a quick read, I have to say that I wish getReport worked !!
> 
> That looks like a lot of work, just to get a response to a setReport. I'll have to see if I can put that together tonight when I get home.
> 
> Thanks again for the response!
> 
> Cheers,
> Richard
> 
> On Apr 12, 2005, at 7:17 AM, Mike wrote:
> 
> > I'm certainly no expert on using IOHIDTransactionInterface, but I do
> > have an application that uses them successfully on 10.2 and 10.3. I
> > agree that there hasn't been much in-depth discussion, and so maybe
> > this reply will help.
> 
>
 _______________________________________________
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: 
 >Re: getting kUSBPipeStalledError on getReport (IOHIDTransactions) (From: Richard Scorer <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.