moto_modem.c 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * Motorola USB Phone driver
  3. *
  4. * Copyright (C) 2008 Greg Kroah-Hartman <greg@kroah.com>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. *
  10. * {sigh}
  11. * Mororola should be using the CDC ACM USB spec, but instead
  12. * they try to just "do their own thing"... This driver should handle a
  13. * few phones in which a basic "dumb serial connection" is needed to be
  14. * able to get a connection through to them.
  15. */
  16. #include <linux/kernel.h>
  17. #include <linux/init.h>
  18. #include <linux/tty.h>
  19. #include <linux/module.h>
  20. #include <linux/usb.h>
  21. #include <linux/usb/serial.h>
  22. static struct usb_device_id id_table [] = {
  23. { USB_DEVICE(0x05c6, 0x3197) }, /* unknown Motorola phone */
  24. { USB_DEVICE(0x0c44, 0x0022) }, /* unknown Mororola phone */
  25. { USB_DEVICE(0x22b8, 0x2a64) }, /* Motorola KRZR K1m */
  26. { USB_DEVICE(0x22b8, 0x2c64) }, /* Motorola V950 phone */
  27. { },
  28. };
  29. MODULE_DEVICE_TABLE(usb, id_table);
  30. static struct usb_driver moto_driver = {
  31. .name = "moto-modem",
  32. .probe = usb_serial_probe,
  33. .disconnect = usb_serial_disconnect,
  34. .id_table = id_table,
  35. .no_dynamic_id = 1,
  36. };
  37. static struct usb_serial_driver moto_device = {
  38. .driver = {
  39. .owner = THIS_MODULE,
  40. .name = "moto-modem",
  41. },
  42. .id_table = id_table,
  43. .num_ports = 1,
  44. };
  45. static int __init moto_init(void)
  46. {
  47. int retval;
  48. retval = usb_serial_register(&moto_device);
  49. if (retval)
  50. return retval;
  51. retval = usb_register(&moto_driver);
  52. if (retval)
  53. usb_serial_deregister(&moto_device);
  54. return retval;
  55. }
  56. static void __exit moto_exit(void)
  57. {
  58. usb_deregister(&moto_driver);
  59. usb_serial_deregister(&moto_device);
  60. }
  61. module_init(moto_init);
  62. module_exit(moto_exit);
  63. MODULE_LICENSE("GPL");