linux.c File Reference

Linux-specific support routines. More...

#include <hid.h>
#include <os.h>
#include <debug.h>
#include <assert.h>

Go to the source code of this file.

Defines

#define HID_INTERNAL

Functions

hid_return hid_os_force_claim (HIDInterface *const hidif, int const interface, HIDInterfaceMatcher const *const matcher, unsigned short retries)
 Forcibly claim an interface from an attached kernel driver.


Detailed Description

Linux-specific support routines.

Definition in file linux.c.


Define Documentation

#define HID_INTERNAL

Definition at line 4 of file linux.c.


Function Documentation

hid_return hid_os_force_claim ( HIDInterface *const   hidif,
int const  interface,
HIDInterfaceMatcher const *const   matcher,
unsigned short retries   
)

Forcibly claim an interface from an attached kernel driver.

This function is necessary in Linux because the kernel prefers that applications and drivers claim a device's appropriate interface before accessing it. For libhid to successfully claim an interface that has already been claimed by hiddev (for instance), libhid must first tell the kernel interface to relinquish control over the interface. This may take several tries.

If the return code is anything but HID_RET_SUCCESS, there will probably be more information in the kernel message buffer (available from the "dmesg" command).

Definition at line 25 of file linux.c.

References HIDInterface_t::dev_handle, ERROR, hid_is_opened(), HID_RET_DEVICE_ALREADY_OPENED, HID_RET_FAIL_CLAIM_IFACE, HID_RET_FAIL_DETACH_DRIVER, HID_RET_INVALID_PARAMETER, HID_RET_SUCCESS, HIDInterface_t::id, TRACE, and WARNING.


Generated on Sun Mar 30 15:28:25 2008 for libhid by  doxygen 1.5.1