hid_opening.c File Reference

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

Go to the source code of this file.

Data Structures

struct  t_open_hid_device_list

Defines

#define HID_INTERNAL
#define MAX_OPEN_DEVICES   20

Enumerations

enum  USBMatchFlags {
  USB_MATCH_NONE = 0x0, USB_MATCH_VENDOR = 0x1, USB_MATCH_PRODUCT = 0x2, USB_MATCH_CUSTOM = 0x4,
  USB_MATCH_ALL = USB_MATCH_VENDOR | USB_MATCH_PRODUCT | USB_MATCH_CUSTOM
}

Functions

static int add_open_device (HIDInterface *hidif)
static void remove_open_device (HIDInterface *hidif)
static int hid_previously_matched (struct usb_dev_handle const *dev_h, int interface)
static unsigned int hid_compare_usb_device (struct usb_dev_handle const *dev_h, HIDInterfaceMatcher const *const match)
static hid_return hid_find_usb_device (HIDInterface *const hidif, HIDInterfaceMatcher const *const match)
static hid_return hid_get_usb_handle (HIDInterface *const hidif, HIDInterfaceMatcher const *const match)
hid_return hid_open (HIDInterface *const hidif, int const interface, HIDInterfaceMatcher const *const matcher)
hid_return hid_force_open (HIDInterface *const hidif, int const interface, HIDInterfaceMatcher const *const matcher, unsigned short retries)
hid_return hid_close (HIDInterface *const hidif)
bool hid_is_opened (HIDInterface const *hidif)

Variables

static struct t_open_hid_device_list open_hid_device_list


Define Documentation

#define HID_INTERNAL

Definition at line 1 of file hid_opening.c.

#define MAX_OPEN_DEVICES   20

Definition at line 18 of file hid_opening.c.

Referenced by add_open_device().


Enumeration Type Documentation

enum USBMatchFlags

Enumerator:
USB_MATCH_NONE 
USB_MATCH_VENDOR 
USB_MATCH_PRODUCT 
USB_MATCH_CUSTOM 
USB_MATCH_ALL 

Definition at line 10 of file hid_opening.c.


Function Documentation

static int add_open_device ( HIDInterface hidif  )  [static]

Definition at line 27 of file hid_opening.c.

References t_open_hid_device_list::hidif, MAX_OPEN_DEVICES, t_open_hid_device_list::nDevices, open_hid_device_list, and TRACE.

Referenced by hid_force_open(), and hid_open().

hid_return hid_close ( HIDInterface *const   hidif  ) 

Definition at line 290 of file hid_opening.c.

References HIDInterface_t::dev_handle, HIDInterface_t::hid_data, hid_is_opened(), HIDInterface_t::hid_parser, hid_reset_HIDInterface(), hid_reset_parser(), HID_RET_FAIL_CLOSE_DEVICE, HID_RET_SUCCESS, HIDInterface_t::id, HIDInterface_t::interface, NOTICE, remove_open_device(), TRACE, and WARNING.

Referenced by hid_force_open(), hid_open(), hid_prepare_interface(), and main().

static unsigned int hid_compare_usb_device ( struct usb_dev_handle const *  dev_h,
HIDInterfaceMatcher const *const   match 
) [static]

Definition at line 66 of file hid_opening.c.

References ASSERT, HIDInterfaceMatcher_t::custom_data, HIDInterfaceMatcher_t::custom_data_length, HIDInterfaceMatcher_t::matcher_fn, HIDInterfaceMatcher_t::product_id, TRACE, USB_MATCH_CUSTOM, USB_MATCH_NONE, USB_MATCH_PRODUCT, USB_MATCH_VENDOR, and HIDInterfaceMatcher_t::vendor_id.

Referenced by hid_find_usb_device().

static hid_return hid_find_usb_device ( HIDInterface *const   hidif,
HIDInterfaceMatcher const *const   match 
) [static]

Definition at line 109 of file hid_opening.c.

References ASSERT, HIDInterface_t::dev_handle, HIDInterface_t::device, hid_compare_usb_device(), hid_is_opened(), hid_previously_matched(), HID_RET_SUCCESS, HIDInterface_t::id, HIDInterface_t::interface, NOTICE, HIDInterfaceMatcher_t::product_id, TRACE, USB_MATCH_ALL, USB_MATCH_CUSTOM, USB_MATCH_PRODUCT, USB_MATCH_VENDOR, and HIDInterfaceMatcher_t::vendor_id.

Referenced by hid_get_usb_handle().

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

Definition at line 241 of file hid_opening.c.

References add_open_device(), ERROR, hid_close(), hid_get_usb_handle(), hid_is_initialised(), hid_is_opened(), hid_os_force_claim(), hid_prepare_interface(), HID_RET_DEVICE_ALREADY_OPENED, HID_RET_INVALID_PARAMETER, HID_RET_NOT_INITIALISED, HID_RET_SUCCESS, HIDInterface_t::id, HIDInterface_t::interface, NOTICE, TRACE, and WARNING.

Referenced by main().

static hid_return hid_get_usb_handle ( HIDInterface *const   hidif,
HIDInterfaceMatcher const *const   match 
) [static]

Definition at line 176 of file hid_opening.c.

References ASSERT, HIDInterface_t::dev_handle, HIDInterface_t::device, hid_find_usb_device(), hid_is_opened(), HID_RET_SUCCESS, and TRACE.

Referenced by hid_force_open(), and hid_open().

bool hid_is_opened ( HIDInterface const *  hidif  ) 

Definition at line 331 of file hid_opening.c.

References HIDInterface_t::dev_handle, and WARNING.

Referenced by hid_close(), hid_dump_tree(), hid_extract_value(), hid_find_object(), hid_find_usb_device(), hid_force_open(), hid_get_feature_report(), hid_get_input_report(), hid_get_item_value(), hid_get_report_size(), hid_get_usb_handle(), hid_init_parser(), hid_interrupt_read(), hid_interrupt_write(), hid_open(), hid_os_force_claim(), hid_prepare_hid_descriptor(), hid_prepare_interface(), hid_prepare_parse_path(), hid_prepare_parser(), hid_prepare_report_descriptor(), hid_reset_parser(), hid_set_feature_report(), hid_set_output_report(), and hid_write_identification().

hid_return hid_open ( HIDInterface *const   hidif,
int const  interface,
HIDInterfaceMatcher const *const   matcher 
)

Definition at line 194 of file hid_opening.c.

References add_open_device(), HIDInterface_t::dev_handle, ERROR, hid_close(), hid_get_usb_handle(), hid_is_initialised(), hid_is_opened(), hid_prepare_interface(), HID_RET_DEVICE_ALREADY_OPENED, HID_RET_FAIL_CLAIM_IFACE, HID_RET_INVALID_PARAMETER, HID_RET_NOT_INITIALISED, HID_RET_SUCCESS, HIDInterface_t::id, HIDInterface_t::interface, NOTICE, TRACE, and WARNING.

static int hid_previously_matched ( struct usb_dev_handle const *  dev_h,
int  interface 
) [static]

Definition at line 52 of file hid_opening.c.

References HIDInterface_t::device, t_open_hid_device_list::hidif, HIDInterface_t::interface, t_open_hid_device_list::nDevices, and open_hid_device_list.

Referenced by hid_find_usb_device().

static void remove_open_device ( HIDInterface hidif  )  [static]

Definition at line 38 of file hid_opening.c.

References t_open_hid_device_list::hidif, t_open_hid_device_list::nDevices, and open_hid_device_list.

Referenced by hid_close().


Variable Documentation

struct t_open_hid_device_list open_hid_device_list [static]

Referenced by add_open_device(), hid_previously_matched(), and remove_open_device().


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