[libhid-discuss] device with multiple interfaces

Arvid Picciani aep at exys.org
Tue May 15 19:40:45 UTC 2007


greetings,
i am trying to write an "userspace driver" for a device.
acording to the manufactor it has 4 interfaces:  (keyboard,mouse,consumer 
device,vendor specific)
the keyboard and mouse are accessed by X11 already, so i guess this might also 
be a problem. i tryed to open them but i get "Device or resource busy". 
not a huge problem since theoreticly X11 should handle them. i want to access 
the fourth interface, which is for controlling the device. 
i get a "3: No such file or directory"  thought  i _know_ it has this 
interface since the vendor has a working controll program on windows and i 
have the information directly from the programmer.

this is my code:


#include <hid.h>

bool match_callback (struct usb_dev_handle const* usbdev, void* custom, 
unsigned int len)
	{
	return true;
        }

int main()
	{
	hid_set_debug(HID_DEBUG_ALL);
	hid_set_debug_stream(stderr);
	hid_set_usb_debug(2);

	hid_init ();

	HIDInterfaceMatcher matcher;
	matcher.vendor_id=0x4243;
	matcher.product_id=0xee08;
	matcher.matcher_fn = match_callback;

	HIDInterface* hid = hid_new_HIDInterface();


	hid_open (hid, 3, &matcher);


	hid_dump_tree (stdout, hid);

	hid_delete_HIDInterface(&hid);
	hid_cleanup ();
	}




and this is the result:



usb_set_debug: Setting debugging level to 2 (on)
 NOTICE: hid_init(): libhid 0.2.16.0.0 is being initialized.
  TRACE: hid_init(): initialising USB subsystem...
usb_os_init: Found USB VFS at /dev/bus/usb
  TRACE: hid_init(): scanning for USB busses...
usb_os_find_busses: Found 005
usb_os_find_busses: Found 004
usb_os_find_busses: Found 003
usb_os_find_busses: Found 002
usb_os_find_busses: Found 001
  TRACE: hid_init(): scanning for USB devices...
usb_os_find_devices: Found 009 on 005
skipped 1 class/vendor specific interface descriptors
skipped 1 class/vendor specific interface descriptors
usb_os_find_devices: Found 005 on 005
skipped 1 class/vendor specific interface descriptors
usb_os_find_devices: Found 004 on 005
usb_os_find_devices: Found 002 on 005
usb_os_find_devices: Found 001 on 005
error obtaining child information: Inappropriate ioctl for device
error obtaining child information: Inappropriate ioctl for device
error obtaining child information: Inappropriate ioctl for device
usb_os_find_devices: Found 001 on 004
usb_os_find_devices: Found 001 on 003
usb_os_find_devices: Found 001 on 002
usb_os_find_devices: Found 001 on 001
 NOTICE: hid_init(): successfully initialised HID library.
  TRACE: hid_new_HIDInterface(): creating a new HIDInterface instance...
  TRACE: hid_open(): opening a device interface according to matching 
criteria...
  TRACE: hid_get_usb_handle(): acquiring handle for a USB device...
  TRACE: hid_find_usb_device(): enumerating USB busses...
  TRACE: hid_find_usb_device(): enumerating USB devices on bus 005...
  TRACE: hid_find_usb_device(): inspecting USB device 005/009[3]...
USB error: could not claim interface 3: No such file or directory
  TRACE: hid_compare_usb_device(): comparing match specifications to USB 
device...
  TRACE: hid_compare_usb_device(): inspecting vendor ID...
  TRACE: hid_compare_usb_device(): match on vendor ID: 0x4243.
  TRACE: hid_compare_usb_device(): inspecting product ID...
  TRACE: hid_compare_usb_device(): match on product ID: 0xee08.
  TRACE: hid_compare_usb_device(): calling custom matching function...
  TRACE: hid_compare_usb_device(): match on custom matching function.
 NOTICE: hid_find_usb_device(): found a matching USB device 005/009[3].
  TRACE: hid_open(): claiming USB device 005/009[3].
USB error: could not claim interface 3: No such file or directory
WARNING: hid_open(): failed to claim USB device 005/009[3].
  TRACE: hid_close(): closing USB device 005/009[3]...
  TRACE: hid_close(): closing handle of USB device 005/009[3]...
 NOTICE: hid_close(): successfully closed USB device 005/009[3].
  TRACE: hid_close(): freeing memory allocated for HID parser...
  TRACE: hid_close(): resetting HIDInterface...
  ERROR: hid_dump_tree(): cannot dump tree of unopened HIDinterface.
 NOTICE: hid_cleanup(): successfully deinitialised HID library.


maybe the lsusb information is interesting for you:

Bus 005 Device 009: ID 4243:ee08
Bus 005 Device 005: ID 0d62:a100 Darfon Electronics Corp. Benq Mouse
Bus 005 Device 004: ID 0aec:3260 Neodio Technologies Corp. 7-in-1 Card Reader
Bus 005 Device 002: ID 05e3:0606 Genesys Logic, Inc.
Bus 005 Device 001: ID 0000:0000
Bus 004 Device 001: ID 0000:0000
Bus 003 Device 001: ID 0000:0000
Bus 002 Device 001: ID 0000:0000
Bus 001 Device 001: ID 0000:0000

i assumed the device 9 on bus 5 is the one i need since it apears when i plug 
in the device.


thanks in advance,
best regards,
Arvid


-- 
Arvid Picciani
exys.org
Open Source developer and activist
Project manager - libqxt                    http://libqxt.sf.net
Project manager - waterjet inovation group  http://waterjet.elli-gym.de
Musician        - freedroid                 http://freedroid.org
---------
DO NOT SEND ME POWERPOINT(tm) OR WORD DOCUMENTS!
they will be directly sent to trash(c), as i'm not allowed by microsoft(tm) to 
read them anyway.



More information about the libhid-discuss mailing list