xsens_mt.c 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Xsens MT USB driver
  4. *
  5. * Copyright (C) 2013 Xsens <info@xsens.com>
  6. */
  7. #include <linux/kernel.h>
  8. #include <linux/tty.h>
  9. #include <linux/module.h>
  10. #include <linux/usb.h>
  11. #include <linux/usb/serial.h>
  12. #include <linux/uaccess.h>
  13. #define XSENS_VID 0x2639
  14. #define MTi_10_IMU_PID 0x0001
  15. #define MTi_20_VRU_PID 0x0002
  16. #define MTi_30_AHRS_PID 0x0003
  17. #define MTi_100_IMU_PID 0x0011
  18. #define MTi_200_VRU_PID 0x0012
  19. #define MTi_300_AHRS_PID 0x0013
  20. #define MTi_G_700_GPS_INS_PID 0x0017
  21. static const struct usb_device_id id_table[] = {
  22. { USB_DEVICE(XSENS_VID, MTi_10_IMU_PID) },
  23. { USB_DEVICE(XSENS_VID, MTi_20_VRU_PID) },
  24. { USB_DEVICE(XSENS_VID, MTi_30_AHRS_PID) },
  25. { USB_DEVICE(XSENS_VID, MTi_100_IMU_PID) },
  26. { USB_DEVICE(XSENS_VID, MTi_200_VRU_PID) },
  27. { USB_DEVICE(XSENS_VID, MTi_300_AHRS_PID) },
  28. { USB_DEVICE(XSENS_VID, MTi_G_700_GPS_INS_PID) },
  29. { },
  30. };
  31. MODULE_DEVICE_TABLE(usb, id_table);
  32. static int xsens_mt_probe(struct usb_serial *serial,
  33. const struct usb_device_id *id)
  34. {
  35. if (serial->interface->cur_altsetting->desc.bInterfaceNumber == 1)
  36. return 0;
  37. return -ENODEV;
  38. }
  39. static struct usb_serial_driver xsens_mt_device = {
  40. .driver = {
  41. .owner = THIS_MODULE,
  42. .name = "xsens_mt",
  43. },
  44. .id_table = id_table,
  45. .num_ports = 1,
  46. .probe = xsens_mt_probe,
  47. };
  48. static struct usb_serial_driver * const serial_drivers[] = {
  49. &xsens_mt_device, NULL
  50. };
  51. module_usb_serial_driver(serial_drivers, id_table);
  52. MODULE_AUTHOR("Frans Klaver <frans.klaver@xsens.com>");
  53. MODULE_DESCRIPTION("USB-serial driver for Xsens motion trackers");
  54. MODULE_LICENSE("GPL v2");