xsens_mt.c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. #include <linux/kernel.h>
  11. #include <linux/tty.h>
  12. #include <linux/module.h>
  13. #include <linux/usb.h>
  14. #include <linux/usb/serial.h>
  15. #include <linux/uaccess.h>
  16. #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
  20. #define MTi_100_IMU_PID 0x0011
  21. #define MTi_200_VRU_PID 0x0012
  22. #define MTi_300_AHRS_PID 0x0013
  23. #define MTi_G_700_GPS_INS_PID 0x0017
  24. static const struct usb_device_id id_table[] = {
  25. { USB_DEVICE(XSENS_VID, MTi_10_IMU_PID) },
  26. { USB_DEVICE(XSENS_VID, MTi_20_VRU_PID) },
  27. { USB_DEVICE(XSENS_VID, MTi_30_AHRS_PID) },
  28. { USB_DEVICE(XSENS_VID, MTi_100_IMU_PID) },
  29. { USB_DEVICE(XSENS_VID, MTi_200_VRU_PID) },
  30. { USB_DEVICE(XSENS_VID, MTi_300_AHRS_PID) },
  31. { USB_DEVICE(XSENS_VID, MTi_G_700_GPS_INS_PID) },
  32. { },
  33. };
  34. MODULE_DEVICE_TABLE(usb, id_table);
  35. static int xsens_mt_probe(struct usb_serial *serial,
  36. const struct usb_device_id *id)
  37. {
  38. if (serial->interface->cur_altsetting->desc.bInterfaceNumber == 1)
  39. return 0;
  40. return -ENODEV;
  41. }
  42. static struct usb_serial_driver xsens_mt_device = {
  43. .driver = {
  44. .owner = THIS_MODULE,
  45. .name = "xsens_mt",
  46. },
  47. .id_table = id_table,
  48. .num_ports = 1,
  49. .probe = xsens_mt_probe,
  50. };
  51. static struct usb_serial_driver * const serial_drivers[] = {
  52. &xsens_mt_device, NULL
  53. };
  54. module_usb_serial_driver(serial_drivers, id_table);
  55. MODULE_AUTHOR("Frans Klaver <frans.klaver@xsens.com>");
  56. MODULE_DESCRIPTION("USB-serial driver for Xsens motion trackers");
  57. MODULE_LICENSE("GPL");