Arthur Huillet | 36045fb | 2005-04-22 15:06:59 -0700 | [diff] [blame] | 1 | /* |
| 2 | * HP4x Calculators Serial USB driver |
| 3 | * |
| 4 | * Copyright (C) 2005 Arthur Huillet (ahuillet@users.sf.net) |
Greg KH | 35ecc48 | 2005-04-22 15:06:59 -0700 | [diff] [blame] | 5 | * Copyright (C) 2001-2005 Greg Kroah-Hartman (greg@kroah.com) |
Arthur Huillet | 36045fb | 2005-04-22 15:06:59 -0700 | [diff] [blame] | 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 as published by |
| 9 | * the Free Software Foundation; either version 2 of the License, or |
| 10 | * (at your option) any later version. |
| 11 | * |
Alan Cox | 3a262b2 | 2008-07-22 11:12:05 +0100 | [diff] [blame] | 12 | * See Documentation/usb/usb-serial.txt for more information on using this |
| 13 | * driver |
Arthur Huillet | 36045fb | 2005-04-22 15:06:59 -0700 | [diff] [blame] | 14 | */ |
| 15 | |
Arthur Huillet | 36045fb | 2005-04-22 15:06:59 -0700 | [diff] [blame] | 16 | #include <linux/kernel.h> |
Arthur Huillet | 36045fb | 2005-04-22 15:06:59 -0700 | [diff] [blame] | 17 | #include <linux/init.h> |
Arthur Huillet | 36045fb | 2005-04-22 15:06:59 -0700 | [diff] [blame] | 18 | #include <linux/tty.h> |
Arthur Huillet | 36045fb | 2005-04-22 15:06:59 -0700 | [diff] [blame] | 19 | #include <linux/module.h> |
Arthur Huillet | 36045fb | 2005-04-22 15:06:59 -0700 | [diff] [blame] | 20 | #include <linux/usb.h> |
Greg Kroah-Hartman | a969888 | 2006-07-11 21:22:58 -0700 | [diff] [blame] | 21 | #include <linux/usb/serial.h> |
Arthur Huillet | 36045fb | 2005-04-22 15:06:59 -0700 | [diff] [blame] | 22 | |
| 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árton | 7d40d7e | 2010-01-10 15:34:24 +0100 | [diff] [blame] | 32 | static const struct usb_device_id id_table[] = { |
Arthur Huillet | 36045fb | 2005-04-22 15:06:59 -0700 | [diff] [blame] | 33 | { USB_DEVICE(HP_VENDOR_ID, HP49GP_PRODUCT_ID) }, |
| 34 | { } /* Terminating entry */ |
| 35 | }; |
| 36 | |
| 37 | MODULE_DEVICE_TABLE(usb, id_table); |
| 38 | |
| 39 | static struct usb_driver hp49gp_driver = { |
Greg Kroah-Hartman | 269bda1 | 2005-06-20 21:15:16 -0700 | [diff] [blame] | 40 | .name = "hp4X", |
Arthur Huillet | 36045fb | 2005-04-22 15:06:59 -0700 | [diff] [blame] | 41 | .probe = usb_serial_probe, |
| 42 | .disconnect = usb_serial_disconnect, |
| 43 | .id_table = id_table, |
Greg Kroah-Hartman | ba9dc65 | 2005-11-16 13:41:28 -0800 | [diff] [blame] | 44 | .no_dynamic_id = 1, |
Arthur Huillet | 36045fb | 2005-04-22 15:06:59 -0700 | [diff] [blame] | 45 | }; |
| 46 | |
Greg Kroah-Hartman | ea65370 | 2005-06-20 21:15:16 -0700 | [diff] [blame] | 47 | static struct usb_serial_driver hp49gp_device = { |
Greg Kroah-Hartman | 18fcac3 | 2005-06-20 21:15:16 -0700 | [diff] [blame] | 48 | .driver = { |
| 49 | .owner = THIS_MODULE, |
Greg Kroah-Hartman | 269bda1 | 2005-06-20 21:15:16 -0700 | [diff] [blame] | 50 | .name = "hp4X", |
Greg Kroah-Hartman | 18fcac3 | 2005-06-20 21:15:16 -0700 | [diff] [blame] | 51 | }, |
Arthur Huillet | 36045fb | 2005-04-22 15:06:59 -0700 | [diff] [blame] | 52 | .id_table = id_table, |
Johannes Hölzl | d9b1b78 | 2006-12-17 21:50:24 +0100 | [diff] [blame] | 53 | .usb_driver = &hp49gp_driver, |
Arthur Huillet | 36045fb | 2005-04-22 15:06:59 -0700 | [diff] [blame] | 54 | .num_ports = 1, |
| 55 | }; |
| 56 | |
| 57 | static 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-Hartman | c197a8d | 2008-08-18 13:21:04 -0700 | [diff] [blame] | 66 | printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" |
| 67 | DRIVER_DESC "\n"); |
Arthur Huillet | 36045fb | 2005-04-22 15:06:59 -0700 | [diff] [blame] | 68 | return 0; |
| 69 | failed_usb_register: |
| 70 | usb_serial_deregister(&hp49gp_device); |
| 71 | failed_usb_serial_register: |
| 72 | return retval; |
| 73 | } |
| 74 | |
Arthur Huillet | 36045fb | 2005-04-22 15:06:59 -0700 | [diff] [blame] | 75 | static void __exit hp49gp_exit(void) |
| 76 | { |
| 77 | usb_deregister(&hp49gp_driver); |
| 78 | usb_serial_deregister(&hp49gp_device); |
| 79 | } |
| 80 | |
Arthur Huillet | 36045fb | 2005-04-22 15:06:59 -0700 | [diff] [blame] | 81 | module_init(hp49gp_init); |
| 82 | module_exit(hp49gp_exit); |
| 83 | |
| 84 | MODULE_DESCRIPTION(DRIVER_DESC); |
| 85 | MODULE_VERSION(DRIVER_VERSION); |
| 86 | MODULE_LICENSE("GPL"); |