blob: a9427a8b86724ae7eec4f19198849293ebabbe44 [file] [log] [blame]
Greg Kroah-Hartman958e8742002-04-09 12:14:34 -07001/*
2 * USB Debug cable driver
3 *
4 * Copyright (C) 2006 Greg Kroah-Hartman <greg@kroah.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
Jason Wessel715b1dc2009-05-11 15:24:07 -050018#define URB_DEBUG_MAX_IN_FLIGHT_URBS 4000
Aleksey Gorelov71be4f82008-06-19 15:22:17 -070019#define USB_DEBUG_MAX_PACKET_SIZE 8
20
Greg Kroah-Hartman958e8742002-04-09 12:14:34 -070021static struct usb_device_id id_table [] = {
22 { USB_DEVICE(0x0525, 0x127a) },
23 { },
24};
25MODULE_DEVICE_TABLE(usb, id_table);
26
27static struct usb_driver debug_driver = {
28 .name = "debug",
29 .probe = usb_serial_probe,
30 .disconnect = usb_serial_disconnect,
31 .id_table = id_table,
32 .no_dynamic_id = 1,
33};
34
Roel Kluin619b5722008-12-09 22:50:22 +010035static int usb_debug_open(struct tty_struct *tty, struct usb_serial_port *port,
Alan Cox95da3102008-07-22 11:09:07 +010036 struct file *filp)
Aleksey Gorelov71be4f82008-06-19 15:22:17 -070037{
38 port->bulk_out_size = USB_DEBUG_MAX_PACKET_SIZE;
Alan Cox95da3102008-07-22 11:09:07 +010039 return usb_serial_generic_open(tty, port, filp);
Aleksey Gorelov71be4f82008-06-19 15:22:17 -070040}
41
Greg Kroah-Hartman958e8742002-04-09 12:14:34 -070042static struct usb_serial_driver debug_device = {
43 .driver = {
44 .owner = THIS_MODULE,
45 .name = "debug",
46 },
47 .id_table = id_table,
Greg Kroah-Hartman958e8742002-04-09 12:14:34 -070048 .num_ports = 1,
Aleksey Gorelov71be4f82008-06-19 15:22:17 -070049 .open = usb_debug_open,
Jason Wessel715b1dc2009-05-11 15:24:07 -050050 .max_in_flight_urbs = URB_DEBUG_MAX_IN_FLIGHT_URBS,
Greg Kroah-Hartman958e8742002-04-09 12:14:34 -070051};
52
53static int __init debug_init(void)
54{
55 int retval;
56
57 retval = usb_serial_register(&debug_device);
58 if (retval)
59 return retval;
60 retval = usb_register(&debug_driver);
61 if (retval)
62 usb_serial_deregister(&debug_device);
63 return retval;
64}
65
66static void __exit debug_exit(void)
67{
68 usb_deregister(&debug_driver);
69 usb_serial_deregister(&debug_device);
70}
71
72module_init(debug_init);
73module_exit(debug_exit);
74MODULE_LICENSE("GPL");