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,8 +947,9 @@ 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",
interface->altsetting->bInterfaceNumber);
sprintf (&interface->dev.bus_id[0], "%s:%d",
dev->devpath,
interface->altsetting->bInterfaceNumber);
if (!desc->iInterface
|| usb_string (dev, desc->iInterface,
interface->dev.name,
......@@ -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;
prod_str = (char *) buf;
mfgr_str = (char *) buf + 256;
/* 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);
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;
}
......
This diff is collapsed.
......@@ -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