blob: 809379159b0e67e21a16db13bb0f556b4e7be19a [file] [log] [blame]
Arthur Huillet36045fb2005-04-22 15:06:59 -07001/*
2 * HP4x Calculators Serial USB driver
3 *
4 * Copyright (C) 2005 Arthur Huillet (ahuillet@users.sf.net)
Greg KH35ecc482005-04-22 15:06:59 -07005 * Copyright (C) 2001-2005 Greg Kroah-Hartman (greg@kroah.com)
Arthur Huillet36045fb2005-04-22 15:06:59 -07006 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
Alan Cox3a262b22008-07-22 11:12:05 +010012 * See Documentation/usb/usb-serial.txt for more information on using this
13 * driver
Arthur Huillet36045fb2005-04-22 15:06:59 -070014 */
15
Arthur Huillet36045fb2005-04-22 15:06:59 -070016#include <linux/kernel.h>
Arthur Huillet36045fb2005-04-22 15:06:59 -070017#include <linux/init.h>
Arthur Huillet36045fb2005-04-22 15:06:59 -070018#include <linux/tty.h>
Arthur Huillet36045fb2005-04-22 15:06:59 -070019#include <linux/module.h>
Arthur Huillet36045fb2005-04-22 15:06:59 -070020#include <linux/usb.h>
Greg Kroah-Hartmana9698882006-07-11 21:22:58 -070021#include <linux/usb/serial.h>
Arthur Huillet36045fb2005-04-22 15:06:59 -070022
23/*
24 * Version Information
25 */
26#define DRIVER_VERSION "v1.00"
27#define DRIVER_DESC "HP4x (48/49) Generic Serial driver"
28
29#define HP_VENDOR_ID 0x03f0
30#define HP49GP_PRODUCT_ID 0x0121
31
Németh Márton7d40d7e2010-01-10 15:34:24 +010032static const struct usb_device_id id_table[] = {
Arthur Huillet36045fb2005-04-22 15:06:59 -070033 { USB_DEVICE(HP_VENDOR_ID, HP49GP_PRODUCT_ID) },
34 { } /* Terminating entry */
35};
36
37MODULE_DEVICE_TABLE(usb, id_table);
38
39static struct usb_driver hp49gp_driver = {
Greg Kroah-Hartman269bda12005-06-20 21:15:16 -070040 .name = "hp4X",
Arthur Huillet36045fb2005-04-22 15:06:59 -070041 .probe = usb_serial_probe,
42 .disconnect = usb_serial_disconnect,
43 .id_table = id_table,
Greg Kroah-Hartmanba9dc652005-11-16 13:41:28 -080044 .no_dynamic_id = 1,
Arthur Huillet36045fb2005-04-22 15:06:59 -070045};
46
Greg Kroah-Hartmanea653702005-06-20 21:15:16 -070047static struct usb_serial_driver hp49gp_device = {
Greg Kroah-Hartman18fcac32005-06-20 21:15:16 -070048 .driver = {
49 .owner = THIS_MODULE,
Greg Kroah-Hartman269bda12005-06-20 21:15:16 -070050 .name = "hp4X",
Greg Kroah-Hartman18fcac32005-06-20 21:15:16 -070051 },
Arthur Huillet36045fb2005-04-22 15:06:59 -070052 .id_table = id_table,
Johannes Hölzld9b1b782006-12-17 21:50:24 +010053 .usb_driver = &hp49gp_driver,
Arthur Huillet36045fb2005-04-22 15:06:59 -070054 .num_ports = 1,
55};
56
57static int __init hp49gp_init(void)
58{
59 int retval;
60 retval = usb_serial_register(&hp49gp_device);
61 if (retval)
62 goto failed_usb_serial_register;
63 retval = usb_register(&hp49gp_driver);
64 if (retval)
65 goto failed_usb_register;
Greg Kroah-Hartmanc197a8d2008-08-18 13:21:04 -070066 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
67 DRIVER_DESC "\n");
Arthur Huillet36045fb2005-04-22 15:06:59 -070068 return 0;
69failed_usb_register:
70 usb_serial_deregister(&hp49gp_device);
71failed_usb_serial_register:
72 return retval;
73}
74
Arthur Huillet36045fb2005-04-22 15:06:59 -070075static void __exit hp49gp_exit(void)
76{
77 usb_deregister(&hp49gp_driver);
78 usb_serial_deregister(&hp49gp_device);
79}
80
Arthur Huillet36045fb2005-04-22 15:06:59 -070081module_init(hp49gp_init);
82module_exit(hp49gp_exit);
83
84MODULE_DESCRIPTION(DRIVER_DESC);
85MODULE_VERSION(DRIVER_VERSION);
86MODULE_LICENSE("GPL");