HID device instance

Is there a way to get a reference to hidd_device_instance_t from a valid
hidd_connection_t and device number? The function
hidd_get_device_instance( ) is present in the documentation but not
available in sys/hiddi.h

I am trying to avoid using an insertion callback.

Thanks
Vilas

“John Nagle” <nagle@downside.com> wrote in message
news:cd6b7e$8ff$1@inn.qnx.com

I’ve written a C++ library which deals with the HID library
and its connect/disconnect issues. Let me know if you’d like a copy.
This deals with all the issues of creating tables of active USB HID
devices and directing the incoming transactions to the correct objects.

Thank you very much for the reply. I would love to have a copy.

regards
Vilas

Is there a way to get a reference to hidd_device_instance_t from a valid
hidd_connection_t and device number? The function
hidd_get_device_instance( ) is present in the documentation but not
available in sys/hiddi.h. I am trying to avoid using an insertion
callback.

I’ve written a C++ library which deals with the HID library
and its connect/disconnect issues. Let me know if you’d like a copy.
This deals with all the issues of creating tables of active USB HID
devices and directing the incoming transactions to the correct objects.

It’s amusing the way the HID library works. Underneath, there’s
a standard QNX resource manager, with open, close, and devctl. That’s
the interface appropriate to QNX.

But that interface isn’t documented. Instead, the documented
QNX interface is a library modelled after Microsoft’s interface
for USB devices. Microsoft software is callback-heavy, because
that’s the way they had to do things in the DOS era, when
they didn’t have threads. The HID library starts up its
own thread, just so it can make callbacks.
(Cautions: 1) the callback thread only has a 4K non-growing
stack; don’t do too much there, and 2) the callback thread
must not block for any length of time or the library breaks.)

I suggest that the resource manager level interface be
documented. The Microsoft emulation layer seems to create
more problems than it solves.

John Nagle
Animats

Vilas Kumar Chitrakaran wrote:

Is there a way to get a reference to hidd_device_instance_t from a valid
hidd_connection_t and device number? The function
hidd_get_device_instance( ) is present in the documentation but not
available in sys/hiddi.h

I am trying to avoid using an insertion callback.

Thanks
Vilas

I’ll add it to the header file.

thanks
Henry

Vilas Kumar Chitrakaran <cvilas@ces.clemson.edu> wrote in message
news:cd62v8$2n6$1@inn.qnx.com

Is there a way to get a reference to hidd_device_instance_t from a valid
hidd_connection_t and device number? The function
hidd_get_device_instance( ) is present in the documentation but not
available in sys/hiddi.h

I am trying to avoid using an insertion callback.

Thanks
Vilas

Hi John:

I’m currently working on getting a handheld USB barcode scanner working on
our embedded system. It IDs itself as:

Product: “Cypress PS/2 Keyboard - PS/2 Mouse”
Interface: 0/0 HID Keyboard
Class: HID
Subclass: Boot Interface
Protocol: Keyboard

Interface: 1/0 HID Mouse
Class: HID
Subclass: Boot Interface
Protocol: Mouse

I load up the devu-ohci and devu-kbd drivers, and then I can:

qnx_prompt> cat /dev/usbkbd0 | hd

And I see the equivalent keyboard scan codes when scanning a barcode. The
question is, I now need to convert these to their ASCII character. This
should be done by the protocol using the en_US_101.kbd file to convert
from scan codes to Symbol… have tried various things including
devi-hirun -Pr kbd -R fd -d /dev/usbkbd0
or
devi-hirun -Pr kbd -R fd -d /dev/usbkbd0 keyboard -k en_US_101.kbd

using -v on devi-hirun gives some debugging output of “USB code: 0x28:
Make…”

I have tried std file I/O via:
filedes = open("/dev/devi/keyboard0", READONLY)
bytesRead = read(filedes, buf, bufSize)
etc, but have not had much luck in getting the ASCII symbols (currently
all numeric)…

Would your lib help with doing this, or have you any detailed knowledge
that might help?

Thanks for any advice…
-Mark
miverson@sierradesign.com

John Nagle wrote:

I’ve written a C++ library which deals with the HID library
and its connect/disconnect issues. Let me know if you’d like a copy.
This deals with all the issues of creating tables of active USB HID
devices and directing the incoming transactions to the correct objects.

It’s amusing the way the HID library works. Underneath, there’s
a standard QNX resource manager, with open, close, and devctl. That’s
the interface appropriate to QNX.

But that interface isn’t documented. Instead, the documented
QNX interface is a library modelled after Microsoft’s interface
for USB devices. Microsoft software is callback-heavy, because
that’s the way they had to do things in the DOS era, when
they didn’t have threads. The HID library starts up its
own thread, just so it can make callbacks.
(Cautions: 1) the callback thread only has a 4K non-growing
stack; don’t do too much there, and 2) the callback thread
must not block for any length of time or the library breaks.)

I suggest that the resource manager level interface be
documented. The Microsoft emulation layer seems to create
more problems than it solves.

John Nagle
Animats

Vilas Kumar Chitrakaran wrote:
Is there a way to get a reference to hidd_device_instance_t from a valid
hidd_connection_t and device number? The function
hidd_get_device_instance( ) is present in the documentation but not
available in sys/hiddi.h

I am trying to avoid using an insertion callback.

Thanks
Vilas

Hi John:

I’m currently working on getting a handheld USB barcode scanner working on
our embedded system. It IDs itself as:

Product: “Cypress PS/2 Keyboard - PS/2 Mouse”
Interface: 0/0 HID Keyboard
Class: HID
Subclass: Boot Interface
Protocol: Keyboard

Interface: 1/0 HID Mouse
Class: HID
Subclass: Boot Interface
Protocol: Mouse

I load up the devu-ohci and devu-kbd drivers, and then I can:

qnx_prompt> cat /dev/usbkbd0 | hd

And I see the equivalent keyboard scan codes when scanning a barcode. The
question is, I now need to convert these to their ASCII character. This
should be done by the protocol using the en_US_101.kbd file to convert
from scan codes to Symbol… have tried various things including
devi-hirun -Pr kbd -R fd -d /dev/usbkbd0
or
devi-hirun -Pr kbd -R fd -d /dev/usbkbd0 keyboard -k en_US_101.kbd

using -v on devi-hirun gives some debugging output of “USB code: 0x28:
Make…”

I have tried std file I/O via:
filedes = open("/dev/devi/keyboard0", READONLY)
bytesRead = read(filedes, buf, bufSize)
etc, but have not had much luck in getting the ASCII symbols (currently
all numeric)…

Would your lib help with doing this, or have you any detailed knowledge
that might help?

Thanks for any advice…
-Mark
miverson@sierradesign.com

John Nagle wrote:

I’ve written a C++ library which deals with the HID library
and its connect/disconnect issues. Let me know if you’d like a copy.
This deals with all the issues of creating tables of active USB HID
devices and directing the incoming transactions to the correct objects.

It’s amusing the way the HID library works. Underneath, there’s
a standard QNX resource manager, with open, close, and devctl. That’s
the interface appropriate to QNX.

But that interface isn’t documented. Instead, the documented
QNX interface is a library modelled after Microsoft’s interface
for USB devices. Microsoft software is callback-heavy, because
that’s the way they had to do things in the DOS era, when
they didn’t have threads. The HID library starts up its
own thread, just so it can make callbacks.
(Cautions: 1) the callback thread only has a 4K non-growing
stack; don’t do too much there, and 2) the callback thread
must not block for any length of time or the library breaks.)

I suggest that the resource manager level interface be
documented. The Microsoft emulation layer seems to create
more problems than it solves.

John Nagle
Animats

Vilas Kumar Chitrakaran wrote:
Is there a way to get a reference to hidd_device_instance_t from a valid
hidd_connection_t and device number? The function
hidd_get_device_instance( ) is present in the documentation but not
available in sys/hiddi.h

I am trying to avoid using an insertion callback.

Thanks
Vilas