1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22#include <unistd.h>
23#include <libudev.h>
24
25#include "usbip_host_common.h"
26#include "usbip_host_driver.h"
27
28#undef PROGNAME
29#define PROGNAME "libusbip"
30
31static int is_my_device(struct udev_device *dev)
32{
33 const char *driver;
34
35 driver = udev_device_get_driver(dev);
36 return driver != NULL && !strcmp(driver, USBIP_HOST_DRV_NAME);
37}
38
39static int usbip_host_driver_open(struct usbip_host_driver *hdriver)
40{
41 int ret;
42
43 hdriver->ndevs = 0;
44 INIT_LIST_HEAD(&hdriver->edev_list);
45
46 ret = usbip_generic_driver_open(hdriver);
47 if (ret)
48 err("please load " USBIP_CORE_MOD_NAME ".ko and "
49 USBIP_HOST_DRV_NAME ".ko!");
50 return ret;
51}
52
53struct usbip_host_driver host_driver = {
54 .edev_list = LIST_HEAD_INIT(host_driver.edev_list),
55 .udev_subsystem = "usb",
56 .ops = {
57 .open = usbip_host_driver_open,
58 .close = usbip_generic_driver_close,
59 .refresh_device_list = usbip_generic_refresh_device_list,
60 .get_device = usbip_generic_get_device,
61 .read_device = read_usb_device,
62 .read_interface = read_usb_interface,
63 .is_my_device = is_my_device,
64 },
65};
66