#define METROUSB_MCR_RTS 0x0a /* Activate RTS. */ #define METROUSB_MCR_DTR 0x09 /* Activate DTR. */ #define WDR_TIMEOUT 5000 /* default urb timeout. */ /* Private data structure. */ struct metrousb_private { spinlock_t lock; int throttled; unsigned long control_state; }; /* Device table list. */ static const struct usb_device_id id_table[] = { { USB_DEVICE(FOCUS_VENDOR_ID, FOCUS_PRODUCT_ID_BI) }, { USB_DEVICE(FOCUS_VENDOR_ID, FOCUS_PRODUCT_ID_UNI) }, { USB_DEVICE_INTERFACE_CLASS(0x0c2e, 0x0730, 0xff) }, /* MS7820 */ { }, /* Terminating entry. */ }; MODULE_DEVICE_TABLE(usb, id_table); /* UNI-Directional mode commands for device configure */ #define UNI_CMD_OPEN 0x80 #define UNI_CMD_CLOSE 0xFF static inline int metrousb_is_unidirectional_mode(struct usb_serial_port *port) { __u16 product_id = le16_to_cpu( port->serial->dev->descriptor.idProduct); return product_id == FOCUS_PRODUCT_ID_UNI; }
* IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE * ARE EXPRESSLY DISCLAIMED. The License provides additional details about * this warranty disclaimer. **/ #include <linux/module.h> #include <linux/usb.h> #include <linux/nfc.h> #include <net/nfc/nci.h> #include <net/nfc/nci_core.h> #include "nfcmrvl.h" #define VERSION "1.0" static struct usb_device_id nfcmrvl_table[] = { { USB_DEVICE_INTERFACE_CLASS(0x1286, 0x2046, 0xff) }, { } /* Terminating entry */ }; MODULE_DEVICE_TABLE(usb, nfcmrvl_table); #define NFCMRVL_USB_BULK_RUNNING 1 #define NFCMRVL_USB_SUSPENDING 2 struct nfcmrvl_usb_drv_data { struct usb_device *udev; struct usb_interface *intf; unsigned long flags; struct work_struct waker; struct usb_anchor tx_anchor; struct usb_anchor bulk_anchor;
static unsigned int poll_ms = DEFAULT_POLL_MS; module_param(poll_ms, uint, S_IRUGO | S_IWUSR); enum escvp_flag { ESCVP_FLAG_CTRL_BUSY }; #if LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0) static const struct usb_device_id id_table[] = { { USB_DEVICE_AND_INTERFACE_INFO(VENDOR_ID, PRODUCT_ID, INTERFACE_CLASS, INTERFACE_SUBCLASS,INTERFACE_PROTOCOL) }, { } }; #else static const struct usb_device_id id_table[] = { { USB_DEVICE_INTERFACE_CLASS(VENDOR_ID, PRODUCT_ID, INTERFACE_CLASS) }, { } }; #endif MODULE_DEVICE_TABLE(usb, id_table); struct escvp_port { int open; struct urb *write_urb; struct urb *control_urb; struct usb_ctrlrequest *dr; spinlock_t lock; struct timer_list poll_timer; struct usb_serial_port *port; // loopback char *ctrl_buf; unsigned long flags;