0001
0002
0003
0004
0005
0006
0007
0008 #include <linux/kernel.h>
0009 #include <linux/tty.h>
0010 #include <linux/module.h>
0011 #include <linux/usb.h>
0012 #include <linux/usb/serial.h>
0013 #include <linux/uaccess.h>
0014
0015 #define XSENS_VID 0x2639
0016
0017 #define MTi_10_IMU_PID 0x0001
0018 #define MTi_20_VRU_PID 0x0002
0019 #define MTi_30_AHRS_PID 0x0003
0020
0021 #define MTi_100_IMU_PID 0x0011
0022 #define MTi_200_VRU_PID 0x0012
0023 #define MTi_300_AHRS_PID 0x0013
0024
0025 #define MTi_G_700_GPS_INS_PID 0x0017
0026
0027 static const struct usb_device_id id_table[] = {
0028 { USB_DEVICE(XSENS_VID, MTi_10_IMU_PID) },
0029 { USB_DEVICE(XSENS_VID, MTi_20_VRU_PID) },
0030 { USB_DEVICE(XSENS_VID, MTi_30_AHRS_PID) },
0031
0032 { USB_DEVICE(XSENS_VID, MTi_100_IMU_PID) },
0033 { USB_DEVICE(XSENS_VID, MTi_200_VRU_PID) },
0034 { USB_DEVICE(XSENS_VID, MTi_300_AHRS_PID) },
0035
0036 { USB_DEVICE(XSENS_VID, MTi_G_700_GPS_INS_PID) },
0037 { },
0038 };
0039 MODULE_DEVICE_TABLE(usb, id_table);
0040
0041 static int xsens_mt_probe(struct usb_serial *serial,
0042 const struct usb_device_id *id)
0043 {
0044 if (serial->interface->cur_altsetting->desc.bInterfaceNumber == 1)
0045 return 0;
0046
0047 return -ENODEV;
0048 }
0049
0050 static struct usb_serial_driver xsens_mt_device = {
0051 .driver = {
0052 .owner = THIS_MODULE,
0053 .name = "xsens_mt",
0054 },
0055 .id_table = id_table,
0056 .num_ports = 1,
0057
0058 .probe = xsens_mt_probe,
0059 };
0060
0061 static struct usb_serial_driver * const serial_drivers[] = {
0062 &xsens_mt_device, NULL
0063 };
0064
0065 module_usb_serial_driver(serial_drivers, id_table);
0066
0067 MODULE_AUTHOR("Frans Klaver <frans.klaver@xsens.com>");
0068 MODULE_DESCRIPTION("USB-serial driver for Xsens motion trackers");
0069 MODULE_LICENSE("GPL v2");