Merge tag 'regmap-fix-v5.11-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux/fpc-iii.git] / drivers / usb / serial / xsens_mt.c
blobcf262c9a963823503b9f600f0a3d0dac2ef942a4
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * Xsens MT USB driver
5 * Copyright (C) 2013 Xsens <info@xsens.com>
6 */
8 #include <linux/kernel.h>
9 #include <linux/tty.h>
10 #include <linux/module.h>
11 #include <linux/usb.h>
12 #include <linux/usb/serial.h>
13 #include <linux/uaccess.h>
15 #define XSENS_VID 0x2639
17 #define MTi_10_IMU_PID 0x0001
18 #define MTi_20_VRU_PID 0x0002
19 #define MTi_30_AHRS_PID 0x0003
21 #define MTi_100_IMU_PID 0x0011
22 #define MTi_200_VRU_PID 0x0012
23 #define MTi_300_AHRS_PID 0x0013
25 #define MTi_G_700_GPS_INS_PID 0x0017
27 static const struct usb_device_id id_table[] = {
28 { USB_DEVICE(XSENS_VID, MTi_10_IMU_PID) },
29 { USB_DEVICE(XSENS_VID, MTi_20_VRU_PID) },
30 { USB_DEVICE(XSENS_VID, MTi_30_AHRS_PID) },
32 { USB_DEVICE(XSENS_VID, MTi_100_IMU_PID) },
33 { USB_DEVICE(XSENS_VID, MTi_200_VRU_PID) },
34 { USB_DEVICE(XSENS_VID, MTi_300_AHRS_PID) },
36 { USB_DEVICE(XSENS_VID, MTi_G_700_GPS_INS_PID) },
37 { },
39 MODULE_DEVICE_TABLE(usb, id_table);
41 static int xsens_mt_probe(struct usb_serial *serial,
42 const struct usb_device_id *id)
44 if (serial->interface->cur_altsetting->desc.bInterfaceNumber == 1)
45 return 0;
47 return -ENODEV;
50 static struct usb_serial_driver xsens_mt_device = {
51 .driver = {
52 .owner = THIS_MODULE,
53 .name = "xsens_mt",
55 .id_table = id_table,
56 .num_ports = 1,
58 .probe = xsens_mt_probe,
61 static struct usb_serial_driver * const serial_drivers[] = {
62 &xsens_mt_device, NULL
65 module_usb_serial_driver(serial_drivers, id_table);
67 MODULE_AUTHOR("Frans Klaver <frans.klaver@xsens.com>");
68 MODULE_DESCRIPTION("USB-serial driver for Xsens motion trackers");
69 MODULE_LICENSE("GPL v2");