[RFC PATCH] USB: ingenico: add support to Ingenico 3070 USB Pin Pad

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 drivers/usb/serial/Kconfig    |    9 +++++
 drivers/usb/serial/Makefile   |    1 +
 drivers/usb/serial/ingenico.c |   71 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 81 insertions(+), 0 deletions(-)
 create mode 100644 drivers/usb/serial/ingenico.c

diff --git a/drivers/usb/serial/Kconfig b/drivers/usb/serial/Kconfig
index bd8aab0..624b47c 100644
--- a/drivers/usb/serial/Kconfig
+++ b/drivers/usb/serial/Kconfig
@@ -458,6 +458,15 @@ config USB_SERIAL_MOTOROLA
 	  To compile this driver as a module, choose M here: the
 	  module will be called moto_modem.  If unsure, choose N.
 
+config USB_SERIAL_INGENICO
+	tristate "USB Ingenico Serial Driver"
+	---help---
+	  Say Y here if you want to use a Ingenico Pin Pad 3070 with a USB
+	  connector as a serial device.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called ingenico.  If unsure, choose N.
+
 config USB_SERIAL_NAVMAN
 	tristate "USB Navman GPS device"
 	help
diff --git a/drivers/usb/serial/Makefile b/drivers/usb/serial/Makefile
index e54c728..8dab6bd 100644
--- a/drivers/usb/serial/Makefile
+++ b/drivers/usb/serial/Makefile
@@ -31,6 +31,7 @@ obj-$(CONFIG_USB_SERIAL_IPAQ)			+= ipaq.o
 obj-$(CONFIG_USB_SERIAL_IPW)			+= ipw.o
 obj-$(CONFIG_USB_SERIAL_IR)			+= ir-usb.o
 obj-$(CONFIG_USB_SERIAL_IUU)			+= iuu_phoenix.o
+obj-$(CONFIG_USB_SERIAL_INGENICO)		+= ingenico.o
 obj-$(CONFIG_USB_SERIAL_KEYSPAN)		+= keyspan.o
 obj-$(CONFIG_USB_SERIAL_KEYSPAN_PDA)		+= keyspan_pda.o
 obj-$(CONFIG_USB_SERIAL_KLSI)			+= kl5kusb105.o
diff --git a/drivers/usb/serial/ingenico.c b/drivers/usb/serial/ingenico.c
new file mode 100644
index 0000000..b6e45df
--- /dev/null
+++ b/drivers/usb/serial/ingenico.c
@@ -0,0 +1,71 @@
+/*
+ * Ingenico USB to Serial driver
+ *
+ * Copyright (C) 2010 Otavio Salvador <otavio@xxxxxxxxxxxxxxxx>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ *
+ *  This driver is based on moto_modem.c written by Greg Kroah-Hartman
+ */
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/tty.h>
+#include <linux/module.h>
+#include <linux/usb.h>
+#include <linux/usb/serial.h>
+
+#define DRIVER_AUTHOR "Otavio Salvador, otavio@xxxxxxxxxxxxxxxx, http://www.ossystems.com.br";
+#define DRIVER_DESC "Ingenico USB Serial Driver"
+
+static const struct usb_device_id id_table[] = {
+	{ USB_DEVICE(0x0b00, 0x3070) },	/* Ingenico 3070 Pin Pad */
+	{ },
+};
+MODULE_DEVICE_TABLE(usb, id_table);
+
+static struct usb_driver ingenico_driver = {
+	.name =		"ingenico",
+	.probe =	usb_serial_probe,
+	.disconnect =	usb_serial_disconnect,
+	.id_table =	id_table,
+	.no_dynamic_id = 	1,
+};
+
+static struct usb_serial_driver ingenico_device = {
+	.driver = {
+		.owner =	THIS_MODULE,
+		.name =		"ingenico",
+	},
+	.id_table =		id_table,
+	.num_ports =		1,
+};
+
+static int __init ingenico_init(void)
+{
+	int retval;
+
+	retval = usb_serial_register(&ingenico_device);
+	if (retval)
+		return retval;
+	retval = usb_register(&ingenico_driver);
+	if (retval)
+		usb_serial_deregister(&ingenico_device);
+	return retval;
+}
+
+static void __exit ingenico_exit(void)
+{
+	usb_deregister(&ingenico_driver);
+	usb_serial_deregister(&ingenico_device);
+}
+
+module_init(ingenico_init);
+module_exit(ingenico_exit);
+
+/* Module information */
+MODULE_AUTHOR(DRIVER_AUTHOR);
+MODULE_DESCRIPTION(DRIVER_DESC);
+MODULE_LICENSE("GPL");
-- 
1.7.1.569.g6f426

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux