Commit 0cd3abca authored by Linus Torvalds's avatar Linus Torvalds

Merge http://linuxusb.bkbits.net/linus-2.5

into penguin.transmeta.com:/home/penguin/torvalds/repositories/kernel/linux
parents 97db62cc f5dbd9a0
......@@ -436,17 +436,21 @@ int usb_clear_halt(struct usb_device *dev, int pipe)
* Within any given configuration, each interface may have several
* alternative settings. These are often used to control levels of
* bandwidth consumption. For example, the default setting for a high
* speed interrupt endpoint may not send more than about 4KBytes per
* microframe, and isochronous endpoints may never be part of a an
* speed interrupt endpoint may not send more than 64 bytes per microframe,
* while interrupt transfers of up to 3KBytes per microframe are legal.
* Also, isochronous endpoints may never be part of an
* interface's default setting. To access such bandwidth, alternate
* interface setting must be made current.
* interface settings must be made current.
*
* Note that in the Linux USB subsystem, bandwidth associated with
* an endpoint in a given alternate setting is not reserved until an
* an endpoint in a given alternate setting is not reserved until an URB
* is submitted that needs that bandwidth. Some other operating systems
* allocate bandwidth early, when a configuration is chosen.
*
* This call is synchronous, and may not be used in an interrupt context.
* Also, drivers must not change altsettings while urbs are scheduled for
* endpoints in that interface; all such urbs must first be completed
* (perhaps forced by unlinking).
*
* Returns zero on success, or else the status code returned by the
* underlying usb_control_msg() call.
......
......@@ -947,7 +947,8 @@ static void usb_find_drivers(struct usb_device *dev)
/* register this interface with driverfs */
interface->dev.parent = &dev->dev;
interface->dev.bus = &usb_bus_type;
sprintf (&interface->dev.bus_id[0], "if%d",
sprintf (&interface->dev.bus_id[0], "%s:%d",
dev->devpath,
interface->altsetting->bInterfaceNumber);
if (!desc->iInterface
|| usb_string (dev, desc->iInterface,
......@@ -1288,56 +1289,59 @@ int usb_set_address(struct usb_device *dev)
*/
static void set_device_description (struct usb_device *dev)
{
char *buf, *here, *end;
void *buf;
int mfgr = dev->descriptor.iManufacturer;
int prod = dev->descriptor.iProduct;
int vendor_id = dev->descriptor.idVendor;
int product_id = dev->descriptor.idProduct;
char *mfgr_str, *prod_str;
/* set default; keep it if there are no strings */
/* set default; keep it if there are no strings, or kmalloc fails */
sprintf (dev->dev.name, "USB device %04x:%04x",
dev->descriptor.idVendor,
dev->descriptor.idProduct);
if (!mfgr && !prod)
return;
vendor_id, product_id);
if (!(buf = kmalloc(256, GFP_KERNEL)))
if (!(buf = kmalloc(256 * 2, GFP_KERNEL)))
return;
here = dev->dev.name;
end = here + sizeof dev->dev.name - 2;
*end = 0;
/* much like pci ... describe as either:
* - both strings: 'product descr (vendor descr)'
* - product only: 'product descr (USB device vvvv:pppp)'
* - vendor only: 'USB device vvvv:pppp (vendor descr)'
* - neither string: 'USB device vvvv:pppp'
*/
if (prod && usb_string (dev, prod, buf, 256) > 0) {
strncpy (here, buf, end - here);
prod_str = (char *) buf;
mfgr_str = (char *) buf + 256;
if (prod && usb_string (dev, prod, prod_str, 256) > 0) {
#ifdef DEBUG
printk (KERN_INFO "Product: %s\n", buf);
printk (KERN_INFO "Product: %s\n", prod_str);
#endif
} else {
buf [0] = 0;
prod = -1;
prod_str = 0;
}
here = strchr (here, 0);
if (mfgr && usb_string (dev, mfgr, buf, 256) > 0) {
*here++ = ' ';
*here++ = '(';
strncpy (here, buf, end - here - 1);
here = strchr (here, 0);
*here++ = ')';
if (mfgr && usb_string (dev, mfgr, mfgr_str, 256) > 0) {
#ifdef DEBUG
printk (KERN_INFO "Manufacturer: %s\n", buf);
printk (KERN_INFO "Manufacturer: %s\n", mfgr_str);
#endif
} else {
if (prod != -1)
snprintf (here, end - here - 1,
" (USB device %04x:%04x)",
dev->descriptor.idVendor,
dev->descriptor.idProduct);
/* both strings unavailable, keep the default */
mfgr_str = 0;
}
/* much like pci ... describe as either:
* - both strings: 'product descr (vendor descr)'
* - product only: 'product descr (USB device vvvv:pppp)'
* - vendor only: 'USB device vvvv:pppp (vendor descr)'
* - neither string: 'USB device vvvv:pppp'
*/
if (prod_str && mfgr_str) {
snprintf(dev->dev.name, sizeof dev->dev.name,
"%s (%s)", prod_str, mfgr_str);
} else if (prod_str) {
snprintf(dev->dev.name, sizeof dev->dev.name,
"%s (USB device %04x:%04x)",
prod_str, vendor_id, product_id);
} else if (mfgr_str) {
snprintf(dev->dev.name, sizeof dev->dev.name,
"USB device %04x:%04x (%s)",
vendor_id, product_id, mfgr_str);
}
kfree(buf);
}
......
......@@ -14,6 +14,7 @@
*/
#include <asm/hardware.h>
#include <asm/mach-types.h>
#include <asm/arch/assabet.h>
#include <asm/arch/badge4.h>
#include <asm/hardware/sa1111.h>
......
......@@ -2053,6 +2053,8 @@ static void start_hc(struct uhci_hcd *uhci)
/* Run and mark it configured with a 64-byte max packet */
outw(USBCMD_RS | USBCMD_CF | USBCMD_MAXP, io_addr + USBCMD);
uhci->hcd.state = USB_STATE_READY;
}
#ifdef CONFIG_PROC_FS
......@@ -2344,8 +2346,6 @@ static int __devinit uhci_start(struct usb_hcd *hcd)
/* disable legacy emulation */
pci_write_config_word(dev, USBLEGSUP, USBLEGSUP_DEFAULT);
hcd->state = USB_STATE_READY;
usb_connect(uhci->rh_dev);
uhci->rh_dev->speed = USB_SPEED_FULL;
......
......@@ -83,7 +83,7 @@ int hid_ff_init(struct hid_device* hid)
hid->dev->descriptor.idProduct);
if (!init) {
warn("hid_ff_init could not find initializer");
dbg("hid_ff_init could not find initializer");
return -ENOSYS;
}
return init->init(hid);
......
......@@ -146,7 +146,7 @@ ioctl_rio(struct inode *inode, struct file *file, unsigned int cmd,
retval = -EFAULT;
goto err_out;
}
if (rio_cmd.length > PAGE_SIZE) {
if (rio_cmd.length < 0 || rio_cmd.length > PAGE_SIZE) {
retval = -EINVAL;
goto err_out;
}
......@@ -216,7 +216,7 @@ ioctl_rio(struct inode *inode, struct file *file, unsigned int cmd,
retval = -EFAULT;
goto err_out;
}
if (rio_cmd.length > PAGE_SIZE) {
if (rio_cmd.length < 0 || rio_cmd.length > PAGE_SIZE) {
retval = -EINVAL;
goto err_out;
}
......
......@@ -14,6 +14,17 @@
* and the website at: http://lpg.ticalc.org/prj_usb/
* for more info.
*
* History :
* 16/07/2002 : v1.04 -- Julien BLACHE <jb@jblache.org>
* + removed useless usblp_cleanup()
* + removed {un,}lock_kernel() as suggested on lkml
* + inlined clear_pipes() (used once)
* + inlined clear_device() (small, used twice)
* + removed tiglusb_find_struct() (used once, simple code)
* + replaced down() with down_interruptible() wherever possible
* + fixed double unregistering wrt devfs, causing devfs
* to force an oops when the device is deconnected
* + removed unused fields from struct tiglusb_t
*/
#include <linux/module.h>
......@@ -30,15 +41,18 @@
#include <linux/ticable.h>
#include "tiglusb.h"
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
# define minor(x) MINOR(x)
#endif
/*
* Version Information
*/
#define DRIVER_VERSION "1.03"
#define DRIVER_VERSION "1.04"
#define DRIVER_AUTHOR "Romain Lievin <roms@lpg.ticalc.org> & Julien Blache <jb@jblache.org>"
#define DRIVER_DESC "TI-GRAPH LINK USB (aka SilverLink) driver"
#define DRIVER_LICENSE "GPL"
/* ----- global variables --------------------------------------------- */
static tiglusb_t tiglusb[MAXTIGL];
......@@ -48,48 +62,47 @@ static devfs_handle_t devfs_handle;
/*---------- misc functions ------------------------------------------- */
/* Unregister device */
static void usblp_cleanup (tiglusb_t * s)
{
devfs_unregister (s->devfs);
//memset(tiglusb[s->minor], 0, sizeof(tiglusb_t));
info ("tiglusb%d removed", s->minor);
}
/* Re-initialize device */
static int clear_device (struct usb_device *dev)
/*
* Re-initialize device
*/
static inline int
clear_device (struct usb_device *dev)
{
if (usb_set_configuration (dev, dev->config[0].bConfigurationValue) < 0) {
err ("tiglusb: clear_device failed");
err ("clear_device failed");
return -1;
}
return 0;
}
/* Clear input & output pipes (endpoints) */
static int clear_pipes (struct usb_device *dev)
/*
* Clear input & output pipes (endpoints)
*/
static inline int
clear_pipes (struct usb_device *dev)
{
unsigned int pipe;
pipe = usb_sndbulkpipe (dev, 1);
if (usb_clear_halt (dev, usb_pipeendpoint (pipe))) {
err("tiglusb: clear_pipe (r), request failed");
err ("clear_pipe (r), request failed");
return -1;
}
pipe = usb_sndbulkpipe (dev, 2);
if (usb_clear_halt (dev, usb_pipeendpoint (pipe))) {
err ("tiglusb: clear_pipe (w), request failed");
err ("clear_pipe (w), request failed");
return -1;
}
return 0;
}
/* ----- kernel module functions--------------------------------------- */
/* ----- file operations functions--------------------------------------- */
static int tiglusb_open (struct inode *inode, struct file *file)
static int
tiglusb_open (struct inode *inode, struct file *filp)
{
int devnum = minor (inode->i_rdev);
ptiglusb_t s;
......@@ -99,37 +112,46 @@ static int tiglusb_open (struct inode *inode, struct file *file)
s = &tiglusb[devnum - TIUSB_MINOR];
down (&s->mutex);
if (down_interruptible (&s->mutex)) {
return -ERESTARTSYS;
}
while (!s->dev || s->opened) {
up (&s->mutex);
if (file->f_flags & O_NONBLOCK) {
if (filp->f_flags & O_NONBLOCK) {
return -EBUSY;
}
schedule_timeout (HZ / 2);
if (signal_pending (current)) {
return -EAGAIN;
}
down (&s->mutex);
if (down_interruptible (&s->mutex)) {
return -ERESTARTSYS;
}
}
s->opened = 1;
up (&s->mutex);
file->f_pos = 0;
file->private_data = s;
filp->f_pos = 0;
filp->private_data = s;
return 0;
}
static int tiglusb_release (struct inode *inode, struct file *file)
static int
tiglusb_release (struct inode *inode, struct file *filp)
{
ptiglusb_t s = (ptiglusb_t) file->private_data;
ptiglusb_t s = (ptiglusb_t) filp->private_data;
if (down_interruptible (&s->mutex)) {
return -ERESTARTSYS;
}
lock_kernel ();
down (&s->mutex);
s->state = _stopped;
up (&s->mutex);
......@@ -139,14 +161,14 @@ static int tiglusb_release (struct inode *inode, struct file *file)
wake_up (&s->remove_ok);
s->opened = 0;
unlock_kernel ();
return 0;
}
static ssize_t tiglusb_read (struct file *file, char *buf, size_t count, loff_t * ppos)
static ssize_t
tiglusb_read (struct file *filp, char *buf, size_t count, loff_t * f_pos)
{
ptiglusb_t s = (ptiglusb_t) file->private_data;
ptiglusb_t s = (ptiglusb_t) filp->private_data;
ssize_t ret = 0;
int bytes_to_read = 0;
int bytes_read = 0;
......@@ -154,7 +176,7 @@ static ssize_t tiglusb_read (struct file *file, char *buf, size_t count, loff_t
char buffer[BULK_RCV_MAX];
unsigned int pipe;
if (*ppos)
if (*f_pos)
return -ESPIPE;
if (s->remove_pending)
......@@ -171,35 +193,35 @@ static ssize_t tiglusb_read (struct file *file, char *buf, size_t count, loff_t
if (result == -ETIMEDOUT) { /* NAK */
ret = result;
if (!bytes_read) {
warn ("quirk !");
dbg ("quirk !");
}
warn ("tiglusb_read, NAK received.");
goto out;
} else if (result == -EPIPE) { /* STALL -- shouldn't happen */
warn ("CLEAR_FEATURE request to remove STALL condition.\n");
warn ("clear_halt request to remove STALL condition.");
if (usb_clear_halt (s->dev, usb_pipeendpoint (pipe)))
warn ("send_packet, request failed\n");
//clear_device(s->dev);
err ("clear_halt, request failed");
clear_device (s->dev);
ret = result;
goto out;
} else if (result < 0) { /* We should not get any I/O errors */
warn ("funky result: %d. Please notify maintainer.", result);
err ("funky result: %d. Please notify maintainer.", result);
ret = -EIO;
goto out;
}
if (copy_to_user (buf, buffer, bytes_read)) {
ret = -EFAULT;
goto out;
}
out:
return ret ? ret : bytes_read;
}
static ssize_t tiglusb_write (struct file *file, const char *buf, size_t count, loff_t * ppos)
static ssize_t
tiglusb_write (struct file *filp, const char *buf, size_t count, loff_t * f_pos)
{
ptiglusb_t s = (ptiglusb_t) file->private_data;
ptiglusb_t s = (ptiglusb_t) filp->private_data;
ssize_t ret = 0;
int bytes_to_write = 0;
int bytes_written = 0;
......@@ -207,7 +229,7 @@ static ssize_t tiglusb_write (struct file *file, const char *buf, size_t count,
char buffer[BULK_SND_MAX];
unsigned int pipe;
if (*ppos)
if (*f_pos)
return -ESPIPE;
if (s->remove_pending)
......@@ -231,10 +253,10 @@ static ssize_t tiglusb_write (struct file *file, const char *buf, size_t count,
ret = result;
goto out;
} else if (result == -EPIPE) { /* STALL -- shouldn't happen */
warn ("CLEAR_FEATURE request to remove STALL condition.");
warn ("clear_halt request to remove STALL condition.");
if (usb_clear_halt (s->dev, usb_pipeendpoint (pipe)))
warn ("send_packet, request failed");
//clear_device(s->dev);
err ("clear_halt, request failed");
clear_device (s->dev);
ret = result;
goto out;
} else if (result < 0) { /* We should not get any I/O errors */
......@@ -245,23 +267,25 @@ static ssize_t tiglusb_write (struct file *file, const char *buf, size_t count,
if (bytes_written != bytes_to_write) {
ret = -EIO;
goto out;
}
out:
return ret ? ret : bytes_written;
}
static int tiglusb_ioctl (struct inode *inode, struct file *file,
static int
tiglusb_ioctl (struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
ptiglusb_t s = (ptiglusb_t) file->private_data;
ptiglusb_t s = (ptiglusb_t) filp->private_data;
int ret = 0;
if (s->remove_pending)
return -EIO;
down (&s->mutex);
if (down_interruptible (&s->mutex)) {
return -ERESTARTSYS;
}
if (!s->dev) {
up (&s->mutex);
......@@ -304,29 +328,18 @@ static struct file_operations tiglusb_fops = {
.release = tiglusb_release,
};
static int tiglusb_find_struct (void)
{
int u;
for (u = 0; u < MAXTIGL; u++) {
ptiglusb_t s = &tiglusb[u];
if (!s->dev)
return u;
}
return -1;
}
/* --- initialisation code ------------------------------------- */
static void *tiglusb_probe (struct usb_device *dev, unsigned int ifnum,
static void *
tiglusb_probe (struct usb_device *dev, unsigned int ifnum,
const struct usb_device_id *id)
{
int minor;
int minor = -1;
int i;
ptiglusb_t s;
char name[8];
dbg ("tiglusb: probing vendor id 0x%x, device id 0x%x ifnum:%d",
dbg ("probing vendor id 0x%x, device id 0x%x ifnum:%d",
dev->descriptor.idVendor, dev->descriptor.idProduct, ifnum);
/*
......@@ -337,7 +350,8 @@ static void *tiglusb_probe (struct usb_device *dev, unsigned int ifnum,
if (dev->descriptor.bNumConfigurations != 1)
return NULL;
if ((dev->descriptor.idProduct != 0xe001) && (dev->descriptor.idVendor != 0x451))
if ((dev->descriptor.idProduct != 0xe001)
&& (dev->descriptor.idVendor != 0x451))
return NULL;
if (usb_set_configuration (dev, dev->config[0].bConfigurationValue) < 0) {
......@@ -345,7 +359,17 @@ static void *tiglusb_probe (struct usb_device *dev, unsigned int ifnum,
return NULL;
}
minor = tiglusb_find_struct ();
/*
* Find a tiglusb struct
*/
for (i = 0; i < MAXTIGL; i++) {
ptiglusb_t s = &tiglusb[i];
if (!s->dev) {
minor = i;
break;
}
}
if (minor == -1)
return NULL;
......@@ -358,26 +382,28 @@ static void *tiglusb_probe (struct usb_device *dev, unsigned int ifnum,
dbg ("bound to interface: %d", ifnum);
sprintf (name, "%d", s->minor);
info ("tiglusb: registering to devfs : major = %d, minor = %d, node = %s", TIUSB_MAJOR,
(TIUSB_MINOR + s->minor), name);
dbg ("registering to devfs : major = %d, minor = %d, node = %s",
TIUSB_MAJOR, (TIUSB_MINOR + s->minor), name);
s->devfs =
devfs_register (devfs_handle, name, DEVFS_FL_DEFAULT, TIUSB_MAJOR,
TIUSB_MINOR + s->minor, S_IFCHR | S_IRUGO | S_IWUGO, &tiglusb_fops,
NULL);
TIUSB_MINOR + s->minor, S_IFCHR | S_IRUGO | S_IWUGO,
&tiglusb_fops, NULL);
/* Display firmware version */
info ("tiglusb: link cable version %i.%02x",
dev->descriptor.bcdDevice >> 8, dev->descriptor.bcdDevice & 0xff);
info ("link cable version %i.%02x",
dev->descriptor.bcdDevice >> 8,
dev->descriptor.bcdDevice & 0xff);
return s;
}
static void tiglusb_disconnect (struct usb_device *dev, void *drv_context)
static void
tiglusb_disconnect (struct usb_device *dev, void *drv_context)
{
ptiglusb_t s = (ptiglusb_t) drv_context;
if (!s || !s->dev)
warn ("bogus disconnect");
info ("bogus disconnect");
s->remove_pending = 1;
wake_up (&s->wait);
......@@ -387,16 +413,12 @@ static void tiglusb_disconnect (struct usb_device *dev, void *drv_context)
s->dev = NULL;
s->opened = 0;
/* cleanup now or later, on close */
if (!s->opened)
usblp_cleanup (s);
else
up (&s->mutex);
/* unregister device */
devfs_unregister (s->devfs);
s->devfs = NULL;
info ("tiglusb: device disconnected");
info ("device %d removed", s->minor);
up (&s->mutex);
}
static struct usb_device_id tiglusb_ids[] = {
......@@ -417,9 +439,11 @@ static struct usb_driver tiglusb_driver = {
/* --- initialisation code ------------------------------------- */
#ifndef MODULE
/* You must set these - there is no sane way to probe for this cable.
* You can use 'tipar=timeout,delay' to set these now. */
static int __init tiglusb_setup (char *str)
/*
* You can use 'tiusb=timeout'
*/
static int __init
tiglusb_setup (char *str)
{
int ints[2];
......@@ -433,7 +457,8 @@ static int __init tiglusb_setup (char *str)
}
#endif
static int __init tiglusb_init (void)
static int __init
tiglusb_init (void)
{
unsigned u;
int result;
......@@ -452,7 +477,7 @@ static int __init tiglusb_init (void)
/* register device */
if (devfs_register_chrdev (TIUSB_MAJOR, "tiglusb", &tiglusb_fops)) {
err ("tiglusb: unable to get major %d", TIUSB_MAJOR);
err ("unable to get major %d", TIUSB_MAJOR);
return -EIO;
}
......@@ -471,7 +496,8 @@ static int __init tiglusb_init (void)
return 0;
}
static void __exit tiglusb_cleanup (void)
static void __exit
tiglusb_cleanup (void)
{
usb_deregister (&tiglusb_driver);
devfs_unregister (devfs_handle);
......
......@@ -33,7 +33,6 @@ typedef struct
{
struct usb_device *dev; /* USB device handle */
struct semaphore mutex; /* locks this struct */
struct semaphore sem;
wait_queue_head_t wait; /* for timed waits */
wait_queue_head_t remove_ok;
......@@ -44,12 +43,6 @@ typedef struct
driver_state_t state; /* started/stopped */
int opened; /* tru if open */
int remove_pending;
char rd_buf[BULK_RCV_MAX]; /* read buffer */
char wr_buf[BULK_SND_MAX]; /* write buffer */
} tiglusb_t, *ptiglusb_t;
extern devfs_handle_t usb_devfs_handle; /* /dev/usb dir. */
#endif
......@@ -21,7 +21,7 @@
#include <asm/uaccess.h>
/* Version Information */
#define DRIVER_VERSION "v0.5.4 (2002/04/11)"
#define DRIVER_VERSION "v0.5.5 (2002/07/22)"
#define DRIVER_AUTHOR "Petko Manolov <petkan@users.sourceforge.net>"
#define DRIVER_DESC "rtl8150 based usb-ethernet driver"
......@@ -68,11 +68,15 @@
/* Define these values to match your device */
#define VENDOR_ID_REALTEK 0x0bda
#define VENDOR_ID_MELCO 0x0411
#define PRODUCT_ID_RTL8150 0x8150
#define PRODUCT_ID_LUAKTX 0x0012
/* table of devices that work with this driver */
static struct usb_device_id rtl8150_table[] = {
{USB_DEVICE(VENDOR_ID_REALTEK, PRODUCT_ID_RTL8150)},
{USB_DEVICE(VENDOR_ID_MELCO, PRODUCT_ID_LUAKTX)},
{}
};
......@@ -729,11 +733,6 @@ static void *rtl8150_probe(struct usb_device *udev, unsigned int ifnum,
err("usb_set_configuration() failed");
return NULL;
}
if ((udev->descriptor.idVendor != VENDOR_ID_REALTEK) ||
(udev->descriptor.idProduct != PRODUCT_ID_RTL8150)) {
err("Not the one we are interested about");
return NULL;
}
dev = kmalloc(sizeof(rtl8150_t), GFP_KERNEL);
if (!dev) {
err("Out of memory");
......
......@@ -71,6 +71,7 @@ static struct usb_device_id id_table [] = {
{ USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID) },
{ USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID) },
{ USB_DEVICE(ELCOM_VENDOR_ID, ELCOM_PRODUCT_ID) },
{ USB_DEVICE(ITEGNO_VENDOR_ID, ITEGNO_PRODUCT_ID) },
{ } /* Terminating entry */
};
......
......@@ -19,3 +19,6 @@
#define ELCOM_VENDOR_ID 0x056e
#define ELCOM_PRODUCT_ID 0x5003
#define ITEGNO_VENDOR_ID 0x0eba
#define ITEGNO_PRODUCT_ID 0x1080
......@@ -67,11 +67,40 @@
/* parity check flag */
#define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK))
/**
* usb_serial_port: structure for the specific ports of a device.
* @magic: magic number for internal validity of this pointer.
* @serial: pointer back to the struct usb_serial owner of this port.
* @tty: pointer to the coresponding tty for this port.
* @number: the number of the port (the minor number).
* @interrupt_in_buffer: pointer to the interrupt in buffer for this port.
* @interrupt_in_urb: pointer to the interrupt in struct urb for this port.
* @interrupt_in_endpointAddress: endpoint address for the interrupt in pipe
* for this port.
* @bulk_in_buffer: pointer to the bulk in buffer for this port.
* @read_urb: pointer to the bulk in struct urb for this port.
* @bulk_in_endpointAddress: endpoint address for the bulk in pipe for this
* port.
* @bulk_out_buffer: pointer to the bulk out buffer for this port.
* @bulk_out_size: the size of the bulk_out_buffer, in bytes.
* @write_urb: pointer to the bulk out struct urb for this port.
* @bulk_out_endpointAddress: endpoint address for the bulk out pipe for this
* port.
* @write_wait: a wait_queue_head_t used by the port.
* @tqueue: task queue for the line discipline waking up.
* @open_count: number of times this port has been opened.
* @sem: struct semaphore used to lock this structure.
* @private: place to put any driver specific information that is needed. The
* usb-serial driver is required to manage this data, the usb-serial core
* will not touch this.
*
* This structure is used by the usb-serial core and drivers for the specific
* ports of a device.
*/
struct usb_serial_port {
int magic;
struct usb_serial *serial; /* pointer back to the owner of this port */
struct tty_struct * tty; /* the coresponding tty for this port */
struct usb_serial *serial;
struct tty_struct * tty;
unsigned char number;
unsigned char * interrupt_in_buffer;
......@@ -88,30 +117,44 @@ struct usb_serial_port {
__u8 bulk_out_endpointAddress;
wait_queue_head_t write_wait;
struct tq_struct tqueue; /* task queue for line discipline waking up */
int open_count; /* number of times this port has been opened */
struct semaphore sem; /* locks this structure */
void * private; /* data private to the specific port */
struct tq_struct tqueue;
int open_count;
struct semaphore sem;
void * private;
};
/**
* usb_serial - structure used by the usb-serial core for a device
* @magic: magic number for internal validity of this pointer.
* @dev: pointer to the struct usb_device for this device
* @type: pointer to the struct usb_serial_device_type for this device
* @interface: pointer to the struct usb_interface for this device
* @minor: the starting minor number for this device
* @num_ports: the number of ports this device has
* @num_interrupt_in: number of interrupt in endpoints we have
* @num_bulk_in: number of bulk in endpoints we have
* @num_bulk_out: number of bulk out endpoints we have
* @vendor: vendor id of this device
* @product: product id of this device
* @port: array of struct usb_serial_port structures for the different ports.
* @private: place to put any driver specific information that is needed. The
* usb-serial driver is required to manage this data, the usb-serial core
* will not touch this.
*/
struct usb_serial {
int magic;
struct usb_device * dev;
struct usb_serial_device_type * type; /* the type of usb serial device this is */
struct usb_interface * interface; /* the interface for this device */
struct tty_driver * tty_driver; /* the tty_driver for this device */
unsigned char minor; /* the starting minor number for this device */
unsigned char num_ports; /* the number of ports this device has */
char num_interrupt_in; /* number of interrupt in endpoints we have */
char num_bulk_in; /* number of bulk in endpoints we have */
char num_bulk_out; /* number of bulk out endpoints we have */
__u16 vendor; /* vendor id of this device */
__u16 product; /* product id of this device */
struct usb_serial_device_type * type;
struct usb_interface * interface;
unsigned char minor;
unsigned char num_ports;
char num_interrupt_in;
char num_bulk_in;
char num_bulk_out;
__u16 vendor;
__u16 product;
struct usb_serial_port port[MAX_NUM_PORTS];
void * private; /* data private to the specific driver */
void * private;
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment