qcaux.c 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /*
  2. * Qualcomm USB Auxiliary Serial Port driver
  3. *
  4. * Copyright (C) 2008 Greg Kroah-Hartman <greg@kroah.com>
  5. * Copyright (C) 2010 Dan Williams <dcbw@redhat.com>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. *
  11. * Devices listed here usually provide a CDC ACM port on which normal modem
  12. * AT commands and PPP can be used. But when that port is in-use by PPP it
  13. * cannot be used simultaneously for status or signal strength. Instead, the
  14. * ports here can be queried for that information using the Qualcomm DM
  15. * protocol.
  16. */
  17. #include <linux/kernel.h>
  18. #include <linux/init.h>
  19. #include <linux/tty.h>
  20. #include <linux/module.h>
  21. #include <linux/usb.h>
  22. #include <linux/usb/serial.h>
  23. /* NOTE: for now, only use this driver for devices that provide a CDC-ACM port
  24. * for normal AT commands, but also provide secondary USB interfaces for the
  25. * QCDM-capable ports. Devices that do not provide a CDC-ACM port should
  26. * probably be driven by option.ko.
  27. */
  28. /* UTStarcom/Pantech/Curitel devices */
  29. #define UTSTARCOM_VENDOR_ID 0x106c
  30. #define UTSTARCOM_PRODUCT_PC5740 0x3701
  31. #define UTSTARCOM_PRODUCT_PC5750 0x3702 /* aka Pantech PX-500 */
  32. #define UTSTARCOM_PRODUCT_UM150 0x3711
  33. #define UTSTARCOM_PRODUCT_UM175_V1 0x3712
  34. #define UTSTARCOM_PRODUCT_UM175_V2 0x3714
  35. #define UTSTARCOM_PRODUCT_UM175_ALLTEL 0x3715
  36. /* CMOTECH devices */
  37. #define CMOTECH_VENDOR_ID 0x16d8
  38. #define CMOTECH_PRODUCT_CDU550 0x5553
  39. #define CMOTECH_PRODUCT_CDX650 0x6512
  40. static struct usb_device_id id_table[] = {
  41. { USB_DEVICE_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, UTSTARCOM_PRODUCT_PC5740, 0xff, 0x00, 0x00) },
  42. { USB_DEVICE_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, UTSTARCOM_PRODUCT_PC5750, 0xff, 0x00, 0x00) },
  43. { USB_DEVICE_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, UTSTARCOM_PRODUCT_UM150, 0xff, 0x00, 0x00) },
  44. { USB_DEVICE_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, UTSTARCOM_PRODUCT_UM175_V1, 0xff, 0x00, 0x00) },
  45. { USB_DEVICE_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, UTSTARCOM_PRODUCT_UM175_V2, 0xff, 0x00, 0x00) },
  46. { USB_DEVICE_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, UTSTARCOM_PRODUCT_UM175_ALLTEL, 0xff, 0x00, 0x00) },
  47. { USB_DEVICE_AND_INTERFACE_INFO(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CDU550, 0xff, 0xff, 0x00) },
  48. { USB_DEVICE_AND_INTERFACE_INFO(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CDX650, 0xff, 0xff, 0x00) },
  49. { },
  50. };
  51. MODULE_DEVICE_TABLE(usb, id_table);
  52. static struct usb_driver qcaux_driver = {
  53. .name = "qcaux",
  54. .probe = usb_serial_probe,
  55. .disconnect = usb_serial_disconnect,
  56. .id_table = id_table,
  57. .no_dynamic_id = 1,
  58. };
  59. static struct usb_serial_driver qcaux_device = {
  60. .driver = {
  61. .owner = THIS_MODULE,
  62. .name = "qcaux",
  63. },
  64. .id_table = id_table,
  65. .num_ports = 1,
  66. };
  67. static int __init qcaux_init(void)
  68. {
  69. int retval;
  70. retval = usb_serial_register(&qcaux_device);
  71. if (retval)
  72. return retval;
  73. retval = usb_register(&qcaux_driver);
  74. if (retval)
  75. usb_serial_deregister(&qcaux_device);
  76. return retval;
  77. }
  78. static void __exit qcaux_exit(void)
  79. {
  80. usb_deregister(&qcaux_driver);
  81. usb_serial_deregister(&qcaux_device);
  82. }
  83. module_init(qcaux_init);
  84. module_exit(qcaux_exit);
  85. MODULE_LICENSE("GPL");