Universal Serial Bus (USB)
Implementation internals » Bus scanning code

USB scan functions. More...

## Macros

#define | IOCNR_GET_DEVICE_ID 1
#define | IOCNR_GET_BUS_ADDRESS 5
#define | IOCNR_GET_VID_PID 6
#define | LPIOC_GET_DEVICE_ID(len)
#define | LPIOC_GET_BUS_ADDRESS(len)
#define | LPIOC_GET_VID_PID(len)
#define | MATCH_FIELD(field, var)

## Functions

static void | get_usb_devs (hd_data_t *hd_data)
static void | set_class_entries (hd_data_t *hd_data, hd_t *hd, usb_t *usb)
static void | add_input_dev (hd_data_t *hd_data, char *name)
static void | get_input_devs (hd_data_t *hd_data)
static void | get_printer_devs (hd_data_t *hd_data)
static void | read_usb_lp (hd_data_t *hd_data, hd_t *hd)
static void | get_serial_devs (hd_data_t *hd_data)
void | hd_scan_sysfs_usb (hd_data_t *hd_data)

## Detailed Description

USB scan functions.

## Macro Definition Documentation

## IOCNR_GET_BUS_ADDRESS

#define IOCNR_GET_BUS_ADDRESS 5

## IOCNR_GET_DEVICE_ID

#define IOCNR_GET_DEVICE_ID 1

## IOCNR_GET_VID_PID

#define IOCNR_GET_VID_PID 6

## LPIOC_GET_BUS_ADDRESS

#define LPIOC_GET_BUS_ADDRESS | ( |  | len | ) |

Value:
_IOC(_IOC_READ, 'P', IOCNR_GET_BUS_ADDRESS, len)
IOCNR_GET_BUS_ADDRESS
#define IOCNR_GET_BUS_ADDRESS
Definition usb.c:25

Referenced by read_usb_lp().

## LPIOC_GET_DEVICE_ID

#define LPIOC_GET_DEVICE_ID | ( |  | len | ) |

Value:
_IOC(_IOC_READ, 'P', IOCNR_GET_DEVICE_ID, len)
IOCNR_GET_DEVICE_ID
#define IOCNR_GET_DEVICE_ID
Definition usb.c:24

Referenced by read_usb_lp().

## LPIOC_GET_VID_PID

#define LPIOC_GET_VID_PID | ( |  | len | ) |

Value:
_IOC(_IOC_READ, 'P', IOCNR_GET_VID_PID, len)
IOCNR_GET_VID_PID
#define IOCNR_GET_VID_PID
Definition usb.c:26

Referenced by read_usb_lp().

## MATCH_FIELD

#define MATCH_FIELD | ( |  | field,
|  |  | var )

Value:
if(!strncasecmp(sl->str, field, sizeof field - 1)) var = sl->str + sizeof field - 1

Referenced by read_usb_lp().

## Function Documentation

## add_input_dev()

void add_input_dev | ( | hd_data_t * | hd_data,
|  | char * | name )

static

References ADD2LOG, s_hd_t::base_class, bc_mouse, bc_none, s_hd_t::compat_device, s_hd_t::compat_vendor, DEV_MICE, free_mem(), get_sysfs_attr_by_path(), hd_data, hd_find_sysfs_id(), hd_read_sysfs_link(), hd_sysfs_id(), hd_id_t::id, hd_dev_num_t::major, MAKE_ID, hd_dev_num_t::minor, new_str(), hd_dev_num_t::range, sc_mou_usb, str_printf(), s_hd_t::sub_class, TAG_SPECIAL, hd_dev_num_t::type, s_hd_t::unix_dev_name, s_hd_t::unix_dev_name2, s_hd_t::unix_dev_num, and s_hd_t::unix_dev_num2.

Referenced by get_input_devs().

## get_input_devs()

void get_input_devs | ( | hd_data_t * | hd_data | ) |

static

References ADD2LOG, add_input_dev(), free_mem(), free_str_list(), hd_data, hd_read_sysfs_link(), new_str(), s_str_list_t::next, read_dir(), s_str_list_t::str, and str_printf().

Referenced by hd_scan_sysfs_usb().

## get_printer_devs()

void get_printer_devs | ( | hd_data_t * | hd_data | ) |

static

References ADD2LOG, free_mem(), free_str_list(), get_sysfs_attr_by_path(), hd_data, hd_read_sysfs_link(), hd_sysfs_id(), hd_dev_num_t::major, hd_dev_num_t::minor, s_hd_t::module, new_str(), s_hd_t::next, s_str_list_t::next, hd_dev_num_t::range, read_dir(), read_usb_lp(), s_str_list_t::str, str_printf(), s_hd_t::sysfs_id, hd_dev_num_t::type, s_hd_t::unix_dev_name, and s_hd_t::unix_dev_num.

Referenced by hd_scan_sysfs_usb().

## get_serial_devs()

void get_serial_devs | ( | hd_data_t * | hd_data | ) |

static

References ADD2LOG, s_hd_t::base_class, bc_comm, s_hd_t::device, free_mem(), free_str_list(), get_sysfs_attr_by_path(), hd_data, hd_read_sysfs_link(), hd_sysfs_id(), hd_id_t::id, hd_dev_num_t::major, MAKE_ID, hd_dev_num_t::minor, s_hd_t::module, new_str(), s_hd_t::next, s_str_list_t::next, s_hd_t::prog_if, hd_dev_num_t::range, read_dir(), sc_com_ser, s_hd_t::tag_s::skip_modem, s_hd_t::tag_s::skip_mouse, s_str_list_t::str, str_printf(), s_hd_t::sub_class, s_hd_t::sysfs_id, s_hd_t::tag, TAG_USB, hd_dev_num_t::type, s_hd_t::unix_dev_name, s_hd_t::unix_dev_num, and s_hd_t::vendor.

Referenced by hd_scan_sysfs_usb().

## get_usb_devs()

void get_usb_devs | ( | hd_data_t * | hd_data | ) |

static

References ADD2LOG, add_hd_entry(), add_res_entry(), add_str_list(), s_hd_t::attached_to, s_hd_t::base_class, u_hd_res_t::baud, bc_modem, bc_scanner, s_hd_t::bus, bus_usb, canon_str(), usb_s::d_cls, usb_s::d_prot, usb_s::d_sub, hd_detail_usb_t::data, s_hd_t::detail, s_hd_t::device, usb_s::device, s_hd_t::drivers, free_mem(), free_str_list(), s_hd_t::func, get_sysfs_attr_by_path(), hd_attr_uint(), hd_data, hd_detail_usb, hd_module_list(), hd_read_sysfs_link(), hd_sysfs_find_driver(), hd_sysfs_id(), usb_s::i_cls, usb_s::i_prot, usb_s::i_sub, hd_id_t::id, s_hd_t::idx, usb_s::ifdescr, MAKE_ID, usb_s::manufact, s_hd_t::modalias, s_hd_t::module, hd_id_t::name, new_mem(), new_str(), s_hd_t::next, s_str_list_t::next, usb_s::product, read_dir(), s_hd_t::tag_s::remove, remove_tagged_hd_entries(), s_hd_t::res, res_baud, usb_s::rev, s_hd_t::revision, search_str_list(), s_hd_t::serial, usb_s::serial, set_class_entries(), res_baud_t::speed, usb_s::speed, s_str_list_t::str, str_printf(), s_hd_t::sysfs_bus_id, s_hd_t::sysfs_id, s_hd_t::tag, TAG_USB, hd_detail_t::type, res_baud_t::type, s_hd_t::unix_dev_name, hd_detail_t::usb, s_hd_t::vendor, and usb_s::vendor.

Referenced by hd_scan_sysfs_usb().

## hd_scan_sysfs_usb()

void hd_scan_sysfs_usb | ( | hd_data_t * | hd_data | ) |

References free_str_list(), get_input_devs(), get_printer_devs(), get_serial_devs(), get_usb_devs(), hd_data, hd_probe_feature(), hd_sysfs_driver_list(), load_module(), mod_usb, pr_usb, PROGRESS, and remove_hd_entries().

Referenced by hd_scan_no_hal().

## read_usb_lp()

void read_usb_lp | ( | hd_data_t * | hd_data,
|  | hd_t * | hd )

static

References ADD2LOG, canon_str(), free_mem(), free_str_list(), hd_data, hd_split(), LPIOC_GET_BUS_ADDRESS, LPIOC_GET_DEVICE_ID, LPIOC_GET_VID_PID, MATCH_FIELD, s_hd_t::model, hd_id_t::name, new_str(), s_str_list_t::next, s_hd_t::serial, str_printf(), s_hd_t::sub_device, s_hd_t::sub_vendor, and s_hd_t::unix_dev_name.

Referenced by get_printer_devs().

## set_class_entries()

void set_class_entries | ( | hd_data_t * | hd_data,
|  | hd_t * | hd,
|  | usb_t * | usb )

static

References s_hd_t::base_class, bc_bluetooth, bc_camera, bc_chipcard, bc_hub, bc_keyboard, bc_modem, bc_mouse, bc_multimedia, bc_network, bc_printer, bc_scanner, bc_storage_device, s_hd_t::compat_device, s_hd_t::compat_vendor, usb_s::d_cls, usb_s::d_prot, usb_s::d_sub, s_hd_t::device, usb_s::device, device_class, hd_data, hd_set_hw_class(), hw_bluetooth, usb_s::i_cls, usb_s::i_prot, usb_s::i_sub, hd_id_t::id, MAKE_ID, sc_camera_digital, sc_keyboard_kbd, sc_mou_usb, sc_multi_audio, sc_sdev_cdrom, sc_sdev_disk, sc_sdev_floppy, sc_sdev_other, sc_sdev_tape, s_hd_t::sub_class, TAG_SPECIAL, TAG_USB, s_hd_t::vendor, and usb_s::vendor.

Referenced by get_usb_devs().