1 /* 2 * Copyright (C) 2005-2007 Takahiro Hirofuchi 3 */ 4 5 #ifndef __VHCI_DRIVER_H 6 #define __VHCI_DRIVER_H 7 8 #include <sysfs/libsysfs.h> 9 #include <stdint.h> 10 11 #include "usbip_common.h" 12 13 #define USBIP_VHCI_BUS_TYPE "platform" 14 #define MAXNPORT 128 15 16 struct usbip_class_device { 17 char class_path[SYSFS_PATH_MAX]; 18 char dev_path[SYSFS_PATH_MAX]; 19 }; 20 21 struct usbip_imported_device { 22 uint8_t port; 23 uint32_t status; 24 25 uint32_t devid; 26 27 uint8_t busnum; 28 uint8_t devnum; 29 30 /* usbip_class_device list */ 31 struct dlist *cdev_list; 32 struct usbip_usb_device udev; 33 }; 34 35 struct usbip_vhci_driver { 36 char sysfs_mntpath[SYSFS_PATH_MAX]; 37 38 /* /sys/devices/platform/vhci_hcd */ 39 struct sysfs_device *hc_device; 40 41 /* usbip_class_device list */ 42 struct dlist *cdev_list; 43 44 int nports; 45 struct usbip_imported_device idev[MAXNPORT]; 46 }; 47 48 49 extern struct usbip_vhci_driver *vhci_driver; 50 51 int usbip_vhci_driver_open(void); 52 void usbip_vhci_driver_close(void); 53 54 int usbip_vhci_refresh_device_list(void); 55 56 57 int usbip_vhci_get_free_port(void); 58 int usbip_vhci_attach_device2(uint8_t port, int sockfd, uint32_t devid, 59 uint32_t speed); 60 61 /* will be removed */ 62 int usbip_vhci_attach_device(uint8_t port, int sockfd, uint8_t busnum, 63 uint8_t devnum, uint32_t speed); 64 65 int usbip_vhci_detach_device(uint8_t port); 66 67 #endif /* __VHCI_DRIVER_H */ 68