Exemplo n.º 1
0
uint8_t
device::usb_device_address () const
{
  int i = 0;
  get_sysattr (dev_, "devnum", i, std::dec);
  return i;
}
Exemplo n.º 2
0
uint8_t
device::usb_port_number () const
{
  int i = 0;
  get_sysattr (dev_, "devpath", i, std::dec);
  return i;
}
Exemplo n.º 3
0
uint8_t
device::usb_bus_number () const
{
  int i = 0;
  get_sysattr (dev_, "busnum", i, std::dec);
  return i;
}
Exemplo n.º 4
0
uint8_t
device::usb_interface () const
{
  int i = 0;
  get_sysattr (dev_, "bInterfaceNumber", i);
  return i;
}
Exemplo n.º 5
0
uint8_t
device::usb_configuration () const
{
  int i = 1;
  get_sysattr (dev_, "bConfigurationValue", i);
  return i;
}
Exemplo n.º 6
0
uint16_t
device::usb_product_id () const
{
  int id;
  get_sysattr (dev_, "idProduct", id);
  return id;
}
Exemplo n.º 7
0
static void add_device(const char *syspath, const char *devname,
			const char *driver, const char *vendor,
			const char *model, struct udev_device *device)
{
	struct udev_device *intf;
	const char *devpath, *devnode, *interface, *number, *label, *sysattr;
	struct modem_info *modem;
	struct device_info *info;

	devpath = udev_device_get_syspath(device);
	if (devpath == NULL)
		return;

	devnode = udev_device_get_devnode(device);
	if (devnode == NULL) {
		devnode = udev_device_get_property_value(device, "INTERFACE");
		if (devnode == NULL)
			return;
	}

	intf = udev_device_get_parent_with_subsystem_devtype(device,
						"usb", "usb_interface");
	if (intf == NULL)
		return;

	modem = g_hash_table_lookup(modem_list, syspath);
	if (modem == NULL) {
		modem = g_try_new0(struct modem_info, 1);
		if (modem == NULL)
			return;

		modem->syspath = g_strdup(syspath);
		modem->devname = g_strdup(devname);
		modem->driver = g_strdup(driver);
		modem->vendor = g_strdup(vendor);
		modem->model = g_strdup(model);

		modem->sysattr = get_sysattr(driver);

		g_hash_table_replace(modem_list, modem->syspath, modem);
	}