aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrans Klaver <frans.klaver@xsens.com>2013-01-25 11:05:44 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-01-25 12:56:54 -0500
commit59e931c47fe44de354ced20136a655d4725a2b61 (patch)
tree32355e9f9f4ab2ed5574168e8e557d1f23068a9b
parent8ab03dd48a549f140597a55a1564083b171d1349 (diff)
usb: add driver for xsens motion trackers
Signed-off-by: Frans Klaver <frans.klaver@xsens.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/serial/Kconfig12
-rw-r--r--drivers/usb/serial/Makefile1
-rw-r--r--drivers/usb/serial/xsens_mt.c86
3 files changed, 99 insertions, 0 deletions
diff --git a/drivers/usb/serial/Kconfig b/drivers/usb/serial/Kconfig
index 76f462241738..dad8363e5b2a 100644
--- a/drivers/usb/serial/Kconfig
+++ b/drivers/usb/serial/Kconfig
@@ -647,6 +647,18 @@ config USB_SERIAL_VIVOPAY_SERIAL
647 To compile this driver as a module, choose M here: the 647 To compile this driver as a module, choose M here: the
648 module will be called vivopay-serial. 648 module will be called vivopay-serial.
649 649
650config USB_SERIAL_XSENS_MT
651 tristate "Xsens motion tracker serial interface driver"
652 help
653 Say Y here if you want to use Xsens motion trackers.
654
655 This driver supports the new generation of motion trackers
656 by Xsens. Older devices can be accessed using the FTDI_SIO
657 driver.
658
659 To compile this driver as a module, choose M here: the
660 module will be called xsens_mt.
661
650config USB_SERIAL_ZIO 662config USB_SERIAL_ZIO
651 tristate "ZIO Motherboard USB serial interface driver" 663 tristate "ZIO Motherboard USB serial interface driver"
652 help 664 help
diff --git a/drivers/usb/serial/Makefile b/drivers/usb/serial/Makefile
index 3b3e7308d476..eaf5ca14dfeb 100644
--- a/drivers/usb/serial/Makefile
+++ b/drivers/usb/serial/Makefile
@@ -61,5 +61,6 @@ obj-$(CONFIG_USB_SERIAL_VISOR) += visor.o
61obj-$(CONFIG_USB_SERIAL_WHITEHEAT) += whiteheat.o 61obj-$(CONFIG_USB_SERIAL_WHITEHEAT) += whiteheat.o
62obj-$(CONFIG_USB_SERIAL_XIRCOM) += keyspan_pda.o 62obj-$(CONFIG_USB_SERIAL_XIRCOM) += keyspan_pda.o
63obj-$(CONFIG_USB_SERIAL_VIVOPAY_SERIAL) += vivopay-serial.o 63obj-$(CONFIG_USB_SERIAL_VIVOPAY_SERIAL) += vivopay-serial.o
64obj-$(CONFIG_USB_SERIAL_XSENS_MT) += xsens_mt.o
64obj-$(CONFIG_USB_SERIAL_ZIO) += zio.o 65obj-$(CONFIG_USB_SERIAL_ZIO) += zio.o
65obj-$(CONFIG_USB_SERIAL_ZTE) += zte_ev.o 66obj-$(CONFIG_USB_SERIAL_ZTE) += zte_ev.o
diff --git a/drivers/usb/serial/xsens_mt.c b/drivers/usb/serial/xsens_mt.c
new file mode 100644
index 000000000000..1d5798d891bc
--- /dev/null
+++ b/drivers/usb/serial/xsens_mt.c
@@ -0,0 +1,86 @@
1/*
2 * Xsens MT USB driver
3 *
4 * Copyright (C) 2013 Xsens <info@xsens.com>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License version
8 * 2 as published by the Free Software Foundation.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/tty.h>
14#include <linux/module.h>
15#include <linux/usb.h>
16#include <linux/usb/serial.h>
17#include <linux/uaccess.h>
18
19#define XSENS_VID 0x2639
20
21#define MTi_10_IMU_PID 0x0001
22#define MTi_20_VRU_PID 0x0002
23#define MTi_30_AHRS_PID 0x0003
24
25#define MTi_100_IMU_PID 0x0011
26#define MTi_200_VRU_PID 0x0012
27#define MTi_300_AHRS_PID 0x0013
28
29#define MTi_G_700_GPS_INS_PID 0x0017
30
31static const struct usb_device_id id_table[] = {
32 { USB_DEVICE(XSENS_VID, MTi_10_IMU_PID) },
33 { USB_DEVICE(XSENS_VID, MTi_20_VRU_PID) },
34 { USB_DEVICE(XSENS_VID, MTi_30_AHRS_PID) },
35
36 { USB_DEVICE(XSENS_VID, MTi_100_IMU_PID) },
37 { USB_DEVICE(XSENS_VID, MTi_200_VRU_PID) },
38 { USB_DEVICE(XSENS_VID, MTi_300_AHRS_PID) },
39
40 { USB_DEVICE(XSENS_VID, MTi_G_700_GPS_INS_PID) },
41 { },
42};
43MODULE_DEVICE_TABLE(usb, id_table);
44
45static int has_required_endpoints(const struct usb_host_interface *interface)
46{
47 __u8 i;
48 int has_bulk_in = 0;
49 int has_bulk_out = 0;
50
51 for (i = 0; i < interface->desc.bNumEndpoints; ++i) {
52 if (usb_endpoint_is_bulk_in(&interface->endpoint[i].desc))
53 has_bulk_in = 1;
54 else if (usb_endpoint_is_bulk_out(&interface->endpoint[i].desc))
55 has_bulk_out = 1;
56 }
57
58 return has_bulk_in && has_bulk_out;
59}
60
61static int xsens_mt_probe(struct usb_serial *serial,
62 const struct usb_device_id *id)
63{
64 if (!has_required_endpoints(serial->interface->cur_altsetting))
65 return -ENODEV;
66 return 0;
67}
68
69static struct usb_serial_driver xsens_mt_device = {
70 .driver = {
71 .owner = THIS_MODULE,
72 .name = "xsens_mt",
73 },
74 .id_table = id_table,
75 .num_ports = 1,
76
77 .probe = xsens_mt_probe,
78};
79
80static struct usb_serial_driver * const serial_drivers[] = {
81 &xsens_mt_device, NULL
82};
83
84module_usb_serial_driver(serial_drivers, id_table);
85
86MODULE_LICENSE("GPL");