#include <linux/spinlock.h>
#include <asm/uaccess.h>
#include <linux/usb.h>
-
-#ifdef CONFIG_USB_SERIAL_DEBUG
- static int debug = 1;
-#else
- static int debug;
-#endif
-
#include "usb-serial.h"
/*
u8 bMaxUnicastList;
} __attribute__ ((packed));
+static int debug;
+
/* if overridden by the user, then use their value for the size of the read and
* write urbs */
-static int buffer_size = 0;
+static int buffer_size;
/* if overridden by the user, then use the specified number of XBOFs */
static int xbof = -1;
};
-struct usb_serial_device_type ir_device = {
+static struct usb_serial_device_type ir_device = {
.owner = THIS_MODULE,
.name = "IR Dongle",
.id_table = id_table,
static int ir_open (struct usb_serial_port *port, struct file *filp)
{
- struct usb_serial *serial = port->serial;
char *buffer;
int result = 0;
- if (port_paranoia_check (port, __FUNCTION__))
- return -ENODEV;
-
dbg("%s - port %d", __FUNCTION__, port->number);
if (buffer_size) {
/* Start reading from the device */
usb_fill_bulk_urb (
port->read_urb,
- serial->dev,
- usb_rcvbulkpipe(serial->dev, port->bulk_in_endpointAddress),
+ port->serial->dev,
+ usb_rcvbulkpipe(port->serial->dev, port->bulk_in_endpointAddress),
port->read_urb->transfer_buffer,
port->read_urb->transfer_buffer_length,
ir_read_bulk_callback,
static void ir_close (struct usb_serial_port *port, struct file * filp)
{
- struct usb_serial *serial;
-
- if (port_paranoia_check (port, __FUNCTION__))
- return;
-
dbg("%s - port %d", __FUNCTION__, port->number);
- serial = get_usb_serial (port, __FUNCTION__);
- if (!serial)
- return;
-
- if (serial->dev) {
- /* shutdown our bulk read */
- usb_unlink_urb (port->read_urb);
- }
+ /* shutdown our bulk read */
+ usb_unlink_urb (port->read_urb);
}
static int ir_write (struct usb_serial_port *port, int from_user, const unsigned char *buf, int count)
{
struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
- if (port_paranoia_check (port, __FUNCTION__))
- return;
-
dbg("%s - port %d", __FUNCTION__, port->number);
if (urb->status) {
}
usb_serial_debug_data (
- __FILE__,
+ debug,
+ &port->dev,
__FUNCTION__,
urb->actual_length,
urb->transfer_buffer);
static void ir_read_bulk_callback (struct urb *urb, struct pt_regs *regs)
{
struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
- struct usb_serial *serial = get_usb_serial (port, __FUNCTION__);
struct tty_struct *tty;
unsigned char *data = urb->transfer_buffer;
int result;
- if (port_paranoia_check (port, __FUNCTION__))
- return;
-
dbg("%s - port %d", __FUNCTION__, port->number);
- if (!serial) {
- dbg("%s - bad serial pointer, exiting", __FUNCTION__);
- return;
- }
-
if (!port->open_count) {
dbg("%s - port closed.", __FUNCTION__);
return;
ir_baud = *data & 0x0f;
usb_serial_debug_data (
- __FILE__,
+ debug,
+ &port->dev,
__FUNCTION__,
urb->actual_length,
data);
*/
tty = port->tty;
+ /*
+ * FIXME: must not do this in IRQ context,
+ * must honour TTY_DONT_FLIP
+ */
tty->ldisc.receive_buf(
tty,
data+1,
/* Continue trying to always read */
usb_fill_bulk_urb (
port->read_urb,
- serial->dev,
- usb_rcvbulkpipe(serial->dev,
+ port->serial->dev,
+ usb_rcvbulkpipe(port->serial->dev,
port->bulk_in_endpointAddress),
port->read_urb->transfer_buffer,
port->read_urb->transfer_buffer_length,
MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_LICENSE("GPL");
-MODULE_PARM(debug, "i");
+module_param(debug, bool, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC(debug, "Debug enabled or not");
-MODULE_PARM(xbof, "i");
+module_param(xbof, int, 0);
MODULE_PARM_DESC(xbof, "Force specific number of XBOFs");
-MODULE_PARM(buffer_size, "i");
+module_param(buffer_size, int, 0);
MODULE_PARM_DESC(buffer_size, "Size of the transfer buffers");