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

Import 2.3.34pre2

parent eb101b30
......@@ -944,7 +944,7 @@ L: linux-usb@suse.com
W: http://www.linux-usb.org
S: Supported
USB HUB AND UHCI DRIVERS
USB HUB
P: Johannes Erdfelt
M: jerdfelt@sventech.com
L: linux-usb@suse.com
......@@ -958,6 +958,13 @@ L: linux-usb@suse.com
S: Maintained (not yet usable)
W: http://suitenine.com/usb/
USB UHCI DRIVER
P: Georg Acher
M: usb@in.tum.de
L: linux-usb@suse.com
W: http://usb.in.tum.de
S: Maintained
VFAT FILESYSTEM:
P: Gordon Chaffee
M: chaffee@cs.berkeley.edu
......
This diff is collapsed.
......@@ -106,7 +106,6 @@ CONFIG_BLK_DEV_IDEPCI=y
# CONFIG_BLK_DEV_OFFBOARD is not set
# CONFIG_BLK_DEV_AEC6210 is not set
CONFIG_BLK_DEV_PIIX=y
# CONFIG_BLK_DEV_PIIX_TUNING is not set
# CONFIG_IDE_CHIPSETS is not set
# CONFIG_BLK_CPQ_DA is not set
......@@ -348,6 +347,11 @@ CONFIG_SERIAL=y
CONFIG_UNIX98_PTYS=y
CONFIG_UNIX98_PTY_COUNT=256
#
# I2C support
#
# CONFIG_I2C is not set
#
# Mice
#
......
......@@ -2805,7 +2805,6 @@ int __init ide_setup (char *s)
drive->scsi = 1;
goto done;
#else
#warning ide scsi-emulation selected but no SCSI-subsystem in kernel
drive->scsi = 0;
goto bad_option;
#endif /* defined(CONFIG_BLK_DEV_IDESCSI) && defined(CONFIG_SCSI) */
......
......@@ -78,6 +78,7 @@
* Released under terms of General Public License
*/
#include <linux/config.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/delay.h>
......
......@@ -50,8 +50,7 @@ endif
ifeq ($(CONFIG_SK98LIN),y)
SUB_DIRS += sk98lin
MOD_IN_SUB_DIRS += sk98lin
L_OBJS += sk98lin/sk98lin.o
obj-y += sk98lin/sk98lin.o
else
ifeq ($(CONFIG_SK98LIN),m)
MOD_IN_SUB_DIRS += sk98lin
......
......@@ -2,7 +2,7 @@
# USB device configuration
#
mainmenu_option next_comment
comment 'Support for USB'
comment 'USB support'
tristate 'Support for USB' CONFIG_USB
if [ ! "$CONFIG_USB" = "n" ]; then
......@@ -15,7 +15,7 @@ comment 'USB Controllers'
comment 'Miscellaneous USB options'
if [ "$CONFIG_PROC_FS" != "n" ]; then
bool ' Preliminary /proc/bus/usb support' CONFIG_USB_PROC
bool ' /proc/bus/usb support' CONFIG_USB_PROC
fi
dep_tristate ' EZUSB Firmware downloader' CONFIG_USB_EZUSB $CONFIG_USB
......
This serial driver currently only works with the Belkin and Peracom USB
Serial devices. It should also work for the Etek converter, but I do
not know the vendor id, and device id of that device (if anyone does,
not know the vendor id and device id of that device (if anyone does,
please let me know.)
If your device is not compatible with the above models, you can try
......@@ -19,17 +19,15 @@ data from the converter. However, since I do not have a spec for the Belkin,
Peracom, and eTek devices, and the raw dumps from the Win98 driver are
confusing, and eTek keeps giving me the run around, no control signals are
currently handled, and the data will most likely come through on a baud
rate that you are not expecting.
The major number that the driver uses is 240 (in the local/experimental
range.) It will stay there until some agreements are reached on how to
handle the configuration problem that USB provides.
To use the driver, create the following nodes:
mknod /dev/ttyUSB0 c 240 0
mknod /dev/ttyUSB1 c 240 1
mknod /dev/ttyUSB2 c 240 2
mknod /dev/ttyUSB3 c 240 3
rate that you are not expecting. So if you have these devices, do not
expect the correct data to show up at either end.
The major number that the driver uses is 188 so to use the driver, create
the following nodes:
mknod /dev/ttyUSB0 c 188 0
mknod /dev/ttyUSB1 c 188 1
mknod /dev/ttyUSB2 c 188 2
mknod /dev/ttyUSB3 c 188 3
then plug in a device and use your friendly terminal program to see what
happens.
......
......@@ -265,7 +265,7 @@ struct usb_audiodev {
spinlock_t lock; /* DMA buffer access spinlock */
struct usbin {
unsigned int interface; /* Interface number */
int interface; /* Interface number, -1 means not used */
unsigned int format; /* USB data format */
unsigned int datapipe; /* the data input pipe */
unsigned int syncpipe; /* the synchronisation pipe - 0 for anything but adaptive IN mode */
......@@ -282,7 +282,7 @@ struct usb_audiodev {
} usbin;
struct usbout {
unsigned int interface; /* Interface number */
int interface; /* Interface number, -1 means not used */
unsigned int format; /* USB data format */
unsigned int datapipe; /* the data input pipe */
unsigned int syncpipe; /* the synchronisation pipe - 0 for anything but asynchronous OUT mode */
......@@ -1927,6 +1927,9 @@ static int usb_audio_ioctl_mixdev(struct inode *inode, struct file *file, unsign
struct usb_mixerdev *ms = (struct usb_mixerdev *)file->private_data;
int i, j, val;
if (!ms->state->usbdev)
return -ENODEV;
if (cmd == SOUND_MIXER_INFO) {
mixer_info info;
strncpy(info.id, "USB_AUDIO", sizeof(info.id));
......@@ -2589,29 +2592,26 @@ static int usb_audio_release(struct inode *inode, struct file *file)
{
struct usb_audiodev *as = (struct usb_audiodev *)file->private_data;
struct usb_audio_state *s = as->state;
struct usb_device *dev = as->state->usbdev;
struct usb_config_descriptor *config=0;
struct usb_device *dev = s->usbdev;
struct usb_interface *iface;
if (s->usbdev)
config = dev->actconfig;
if (file->f_mode & FMODE_WRITE)
drain_out(as, file->f_flags & O_NONBLOCK);
down(&open_sem);
if (file->f_mode & FMODE_WRITE) {
usbout_stop(as);
if (s->usbdev) {
iface = &config->interface[as->usbout.interface];
usb_set_interface(s->usbdev, iface->altsetting->bInterfaceNumber, 0);
if (dev && as->usbout.interface >= 0) {
iface = &dev->actconfig->interface[as->usbout.interface];
usb_set_interface(dev, iface->altsetting->bInterfaceNumber, 0);
}
dmabuf_release(&as->usbout.dma);
usbout_release(as);
}
if (file->f_mode & FMODE_READ) {
usbin_stop(as);
if (s->usbdev) {
iface = &config->interface[as->usbin.interface];
usb_set_interface(s->usbdev, iface->altsetting->bInterfaceNumber, 0);
if (dev && as->usbin.interface >= 0) {
iface = &dev->actconfig->interface[as->usbin.interface];
usb_set_interface(dev, iface->altsetting->bInterfaceNumber, 0);
}
dmabuf_release(&as->usbin.dma);
usbin_release(as);
......
......@@ -201,12 +201,14 @@ static int usb_cpia_set_sensor_fps(struct usb_device *dev, int sensorbaserate, i
(sensorbaserate << 8) + sensorclkdivisor, 0, NULL, 0, HZ);
}
#ifdef NOTUSED
static int usb_cpia_grab_frame(struct usb_device *dev, int streamstartline)
{
return usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
USB_REQ_CPIA_GRAB_FRAME, USB_TYPE_VENDOR | USB_RECIP_DEVICE,
streamstartline << 8, 0, NULL, 0, HZ);
}
#endif
static int usb_cpia_upload_frame(struct usb_device *dev, int forceupload)
{
......@@ -514,23 +516,24 @@ copylen += 6;
/*
* Make all of the blocks of data contiguous
*/
static int cpia_compress_isochronous(struct usb_cpia *cpia, struct usb_isoc_desc *isodesc)
static int cpia_compress_isochronous(struct usb_cpia *cpia, urb_t *urb)
{
unsigned char *cdata, *data;
int i, totlen = 0;
cdata = isodesc->data;
data = cpia->scratch + cpia->scratchlen;
for (i = 0; i < isodesc->frame_count; i++) {
int n = isodesc->frames[i].frame_length;
int st = isodesc->frames[i].frame_status;
for (i = 0; i < urb->number_of_packets; i++) {
int n = urb->iso_frame_desc[i].actual_length;
int st = urb->iso_frame_desc[i].status;
cdata = urb->transfer_buffer + urb->iso_frame_desc[i].offset;
if (st && debug >= 1)
printk(KERN_DEBUG "cpia data error: [%d] len=%d, status=%X\n",
i, n, st);
if ((cpia->scratchlen + n) > SCRATCH_BUF_SIZE) {
printk(KERN_DEBUG "cpia: scratch buf overflow!\n");
printk(KERN_DEBUG "cpia: scratch buf overflow!scr_len: %d, n: %d\n",cpia->scratchlen, n );
return totlen;
}
......@@ -540,30 +543,33 @@ static int cpia_compress_isochronous(struct usb_cpia *cpia, struct usb_isoc_desc
totlen += n;
cpia->scratchlen += n;
}
cdata += isodesc->frame_size;
}
return totlen;
}
static int cpia_isoc_irq(int status, void *__buffer, int len, void *isocdesc)
static void cpia_isoc_irq(struct urb *urb)
{
void *dev_id = ((struct usb_isoc_desc *)isocdesc)->context;
struct usb_cpia *cpia = (struct usb_cpia *)dev_id;
int len;
struct usb_cpia *cpia = urb->context;
struct cpia_sbuf *sbuf;
int i;
#if 0
printk("cpia_isoc_irq: %p status %d, errcount = %d, length = %d\n", urb, urb->status, urb->error_count, urb->actual_length);
#endif
if (!cpia->streaming) {
if (debug >= 1)
printk(KERN_DEBUG "cpia: oops, not streaming, but interrupt\n");
return 0;
return;
}
sbuf = &cpia->sbuf[cpia->cursbuf];
usb_kill_isoc(sbuf->isodesc);
// usb_kill_isoc(sbuf->isodesc);
/* Copy the data received into our scratch buffer */
len = cpia_compress_isochronous(cpia, sbuf->isodesc);
len = cpia_compress_isochronous(cpia, urb);
/* If we don't have a frame we're current working on, complain */
if (cpia->scratchlen) {
......@@ -574,22 +580,23 @@ static int cpia_isoc_irq(int status, void *__buffer, int len, void *isocdesc)
cpia_parse_data(cpia);
}
for (i = 0; i < FRAMES_PER_DESC; i++)
sbuf->isodesc->frames[i].frame_length = FRAME_SIZE_PER_DESC;
for (i = 0; i < FRAMES_PER_DESC; i++) {
sbuf->urb->iso_frame_desc[i].status = 0;
sbuf->urb->iso_frame_desc[i].actual_length = 0;
}
/* Move to the next sbuf */
cpia->cursbuf = (cpia->cursbuf + 1) % CPIA_NUMSBUF;
/* Reschedule this block of Isochronous desc */
usb_run_isoc(sbuf->isodesc, cpia->sbuf[cpia->cursbuf].isodesc);
// usb_run_isoc(sbuf->isodesc, cpia->sbuf[cpia->cursbuf].isodesc);
return -1;
return;
}
static int cpia_init_isoc(struct usb_cpia *cpia)
{
struct usb_device *dev = cpia->dev;
struct usb_isoc_desc *id;
urb_t *urb;
int fx, err;
cpia->compress = 0;
......@@ -598,57 +605,63 @@ static int cpia_init_isoc(struct usb_cpia *cpia)
cpia->scratchlen = 0;
/* Alternate interface 3 is is the biggest frame size */
if (usb_set_interface(cpia->dev, 1, 3) < 0) {
if (usb_set_interface(cpia->dev, cpia->iface, 3) < 0) {
printk(KERN_ERR "usb_set_interface error\n");
return -EBUSY;
}
/* We double buffer the Iso lists */
err = usb_init_isoc(dev, usb_rcvisocpipe(dev, 1), FRAMES_PER_DESC,
cpia, &cpia->sbuf[0].isodesc);
if (err) {
// err = usb_init_isoc(dev, usb_rcvisocpipe(dev, 1), FRAMES_PER_DESC, cpia, &cpia->sbuf[0].isodesc);
urb = usb_alloc_urb(FRAMES_PER_DESC);
if (!urb) {
printk(KERN_ERR "cpia_init_isoc: usb_init_isoc ret %d\n",
err);
0);
return -ENOMEM;
}
err = usb_init_isoc(dev, usb_rcvisocpipe(dev, 1), FRAMES_PER_DESC,
cpia, &cpia->sbuf[1].isodesc);
if (err) {
cpia->sbuf[0].urb = urb;
urb->dev = dev;
urb->context = cpia;
urb->pipe = usb_rcvisocpipe(dev, 1);
urb->transfer_flags = USB_ISO_ASAP;
urb->transfer_buffer = cpia->sbuf[0].data;
urb->complete = cpia_isoc_irq;
urb->number_of_packets = FRAMES_PER_DESC;
urb->transfer_buffer_length = FRAME_SIZE_PER_DESC * FRAMES_PER_DESC;
for (fx = 0; fx < FRAMES_PER_DESC; fx++) {
urb->iso_frame_desc[fx].offset = FRAME_SIZE_PER_DESC * fx;
urb->iso_frame_desc[fx].length = FRAME_SIZE_PER_DESC;
}
urb = usb_alloc_urb(FRAMES_PER_DESC);
if (!urb) {
printk(KERN_ERR "cpia_init_isoc: usb_init_isoc ret %d\n",
err);
usb_free_isoc (cpia->sbuf[0].isodesc);
0);
return -ENOMEM;
}
cpia->sbuf[1].urb = urb;
urb->dev = dev;
urb->context = cpia;
urb->pipe = usb_rcvisocpipe(dev, 1);
urb->transfer_flags = USB_ISO_ASAP;
urb->transfer_buffer = cpia->sbuf[1].data;
urb->complete = cpia_isoc_irq;
urb->number_of_packets = FRAMES_PER_DESC;
urb->transfer_buffer_length = FRAME_SIZE_PER_DESC * FRAMES_PER_DESC;
for (fx = 0; fx < FRAMES_PER_DESC; fx++) {
urb->iso_frame_desc[fx].offset = FRAME_SIZE_PER_DESC * fx;
urb->iso_frame_desc[fx].length = FRAME_SIZE_PER_DESC;
}
/* Set the Isoc. desc. parameters. */
/* First for desc. [0] */
id = cpia->sbuf[0].isodesc;
id->start_type = START_ASAP;
id->callback_frames = 10; /* on every 10th frame */
id->callback_fn = cpia_isoc_irq;
id->data = cpia->sbuf[0].data;
id->buf_size = FRAME_SIZE_PER_DESC * FRAMES_PER_DESC;
for (fx = 0; fx < FRAMES_PER_DESC; fx++)
id->frames[fx].frame_length = FRAME_SIZE_PER_DESC;
/* and for desc. [1] */
id = cpia->sbuf[1].isodesc;
id->start_type = 0; /* will follow the first desc. */
id->callback_frames = 10; /* on every 10th frame */
id->callback_fn = cpia_isoc_irq;
id->data = cpia->sbuf[1].data;
id->buf_size = FRAME_SIZE_PER_DESC * FRAMES_PER_DESC;
for (fx = 0; fx < FRAMES_PER_DESC; fx++)
id->frames[fx].frame_length = FRAME_SIZE_PER_DESC;
err = usb_run_isoc(cpia->sbuf[0].isodesc, NULL);
cpia->sbuf[1].urb->next = cpia->sbuf[0].urb;
cpia->sbuf[0].urb->next = cpia->sbuf[1].urb;
err = usb_submit_urb(cpia->sbuf[0].urb);
if (err)
printk(KERN_ERR "cpia_init_isoc: usb_run_isoc ret %d\n",
printk(KERN_ERR "cpia_init_isoc: usb_run_isoc(0) ret %d\n",
err);
err = usb_run_isoc(cpia->sbuf[1].isodesc, cpia->sbuf[0].isodesc);
err = usb_submit_urb(cpia->sbuf[1].urb);
if (err)
printk(KERN_ERR "cpia_init_isoc: usb_run_isoc ret %d\n",
printk(KERN_ERR "cpia_init_isoc: usb_run_isoc(1) ret %d\n",
err);
cpia->streaming = 1;
......@@ -668,20 +681,20 @@ static void cpia_stop_isoc(struct usb_cpia *cpia)
}
/* Set packet size to 0 */
if (usb_set_interface(cpia->dev, 1, 0) < 0) {
if (usb_set_interface(cpia->dev, cpia->iface, 0) < 0) {
printk(KERN_ERR "usb_set_interface error\n");
return /* -EINVAL */;
}
/* Unschedule all of the iso td's */
usb_kill_isoc(cpia->sbuf[1].isodesc);
usb_kill_isoc(cpia->sbuf[0].isodesc);
usb_unlink_urb(cpia->sbuf[1].urb);
usb_unlink_urb(cpia->sbuf[0].urb);
cpia->streaming = 0;
/* Delete them all */
usb_free_isoc(cpia->sbuf[1].isodesc);
usb_free_isoc(cpia->sbuf[0].isodesc);
usb_free_urb(cpia->sbuf[1].urb);
usb_free_urb(cpia->sbuf[0].urb);
}
static int cpia_new_frame(struct usb_cpia *cpia, int framenum)
......@@ -1197,12 +1210,8 @@ static int usb_cpia_configure(struct usb_cpia *cpia)
struct usb_device *dev = cpia->dev;
unsigned char version[4];
/* claim interface 1 */
usb_driver_claim_interface(&cpia_driver,
&dev->actconfig->interface[1], cpia);
/* Set altsetting 0 on interface 1 */
if (usb_set_interface(dev, 1, 0) < 0) {
/* Set altsetting 0 */
if (usb_set_interface(dev, cpia->iface, 0) < 0) {
printk(KERN_ERR "usb_set_interface error\n");
return -EBUSY;
}
......@@ -1273,7 +1282,7 @@ static int usb_cpia_configure(struct usb_cpia *cpia)
error:
video_unregister_device(&cpia->vdev);
usb_driver_release_interface(&cpia_driver,
&dev->actconfig->interface[1]);
&dev->actconfig->interface[0]);
kfree(cpia);
......@@ -1314,6 +1323,7 @@ static void * cpia_probe(struct usb_device *dev, unsigned int ifnum)
memset(cpia, 0, sizeof(*cpia));
cpia->dev = dev;
cpia->iface = interface->bInterfaceNumber;
if (!usb_cpia_configure(cpia)) {
cpia->user=0;
......@@ -1329,7 +1339,7 @@ static void cpia_disconnect(struct usb_device *dev, void *ptr)
video_unregister_device(&cpia->vdev);
usb_driver_release_interface(&cpia_driver,
&cpia->dev->actconfig->interface[1]);
&cpia->dev->actconfig->interface[0]);
/* Free the memory */
kfree(cpia);
......
......@@ -137,7 +137,7 @@ struct usb_device;
struct cpia_sbuf {
char *data;
struct usb_isoc_desc *isodesc;
urb_t *urb;
};
enum {
......@@ -179,6 +179,8 @@ struct usb_cpia {
/* Device structure */
struct usb_device *dev;
unsigned char iface;
struct semaphore lock;
int user; /* user count for exclusive use */
......
This diff is collapsed.
......@@ -36,7 +36,6 @@
/*****************************************************************************/
#include <linux/version.h>
#include <linux/config.h>
#include <linux/module.h>
#include <linux/socket.h>
#include <linux/miscdevice.h>
......
//$Id: firmware.c,v 1.4 1999/12/13 14:15:28 fliegl Exp $
//$Id: firmware.h,v 1.1 1999/12/17 08:55:05 fliegl Exp $
static INTEL_HEX_RECORD firmware[] = {
{ 2,
0x0,
......
......@@ -121,8 +121,10 @@ static int usb_hub_configure(struct usb_hub *hub)
if (!bitmap)
return -1;
if (usb_get_hub_descriptor(dev, bitmap, header->bLength) < 0)
if (usb_get_hub_descriptor(dev, bitmap, header->bLength) < 0) {
kfree(bitmap);
return -1;
}
descriptor = (struct usb_hub_descriptor *)bitmap;
......@@ -321,10 +323,10 @@ static void usb_hub_port_connect_change(struct usb_device *hub, int port)
/* We're done now, we already disconnected the device */
return;
}
wait_ms(500);
wait_ms(400);
/* Reset the port */
usb_set_port_feature(hub, port + 1, USB_PORT_FEAT_RESET);
wait_ms(500);
wait_ms(100);
/* Allocate a new device struct for it */
usb = usb_alloc_dev(hub, hub->bus);
if (!usb) {
......
......@@ -32,8 +32,7 @@
#define USBKBD_REPEAT_DELAY (HZ / 4)
#define USBKBD_REPEAT_RATE (HZ / 20)
struct usb_keyboard
{
struct usb_keyboard {
struct usb_device *dev;
unsigned long down[2];
unsigned char repeat_key;
......@@ -45,14 +44,13 @@ struct usb_keyboard
extern unsigned char usb_kbd_map[];
static void * usb_kbd_probe(struct usb_device *dev, unsigned int i);
static void *usb_kbd_probe(struct usb_device *dev, unsigned int i);
static void usb_kbd_disconnect(struct usb_device *dev, void *ptr);
static void usb_kbd_repeat(unsigned long dummy);
static LIST_HEAD(usb_kbd_list);
static struct usb_driver usb_kbd_driver =
{
static struct usb_driver usb_kbd_driver = {
"keyboard",
usb_kbd_probe,
usb_kbd_disconnect,
......@@ -60,15 +58,12 @@ static struct usb_driver usb_kbd_driver =
};
static void
usb_kbd_handle_key(unsigned char key, int down)
static void usb_kbd_handle_key(unsigned char key, int down)
{
int scancode = (int) usb_kbd_map[key];
if(scancode)
{
if (scancode) {
#ifndef CONFIG_MAC_KEYBOARD
if(scancode & PCKBD_NEEDS_E0)
{
if (scancode & PCKBD_NEEDS_E0) {
handle_scancode(0xe0, 1);
}
#endif /* CONFIG_MAC_KEYBOARD */
......@@ -76,17 +71,15 @@ usb_kbd_handle_key(unsigned char key, int down)
}
}
static void
usb_kbd_repeat(unsigned long dev_id)
static void usb_kbd_repeat(unsigned long dev_id)
{
struct usb_keyboard *kbd = (struct usb_keyboard*) dev_id;
struct usb_keyboard *kbd = (struct usb_keyboard *) dev_id;
unsigned long flags;
save_flags(flags);
cli();
if(kbd->repeat_key)
{
if (kbd->repeat_key) {
usb_kbd_handle_key(kbd->repeat_key, 1);
/* reset repeat timer */
......@@ -101,11 +94,10 @@ usb_kbd_repeat(unsigned long dev_id)
restore_flags(flags);
}
static int
usb_kbd_irq(int state, void *buffer, int len, void *dev_id)
static int usb_kbd_irq(int state, void *buffer, int len, void *dev_id)
{
struct usb_keyboard *kbd = (struct usb_keyboard*) dev_id;
unsigned long *down = (unsigned long*) buffer;
struct usb_keyboard *kbd = (struct usb_keyboard *) dev_id;
unsigned long *down = (unsigned long *) buffer;
/*
* USB_ST_NOERROR is the normal case.
......@@ -116,43 +108,48 @@ usb_kbd_irq(int state, void *buffer, int len, void *dev_id)
switch (state) {
case USB_ST_REMOVED:
case USB_ST_INTERNALERROR:
printk(KERN_DEBUG "%s(%d): Suspending\n", __FILE__, __LINE__);
printk(KERN_DEBUG "%s(%d): Suspending\n", __FILE__,
__LINE__);
return 0; /* disable */
case USB_ST_NOERROR: break;
default: return 1; /* ignore */
case USB_ST_NOERROR:
break;
default:
return 1; /* ignore */
}
if(kbd->down[0] != down[0] || kbd->down[1] != down[1]) {
if (kbd->down[0] != down[0] || kbd->down[1] != down[1]) {
unsigned char *olddown, *newdown;
unsigned char modsdelta, key;
int i;
/* handle modifier change */
modsdelta = (*(unsigned char*) down ^ *(unsigned char*) kbd->down);
if(modsdelta)
{
for(i = 0; i < 8; i++)
{
if(modsdelta & 0x01)
{
int pressed = (*(unsigned char*) down >> i) & 0x01;
usb_kbd_handle_key(
i + USBKBD_MODIFIER_BASE,
modsdelta =
(*(unsigned char *) down ^ *(unsigned char *) kbd->
down);
if (modsdelta) {
for (i = 0; i < 8; i++) {
if (modsdelta & 0x01) {
int pressed =
(*(unsigned char *) down >> i)
& 0x01;
usb_kbd_handle_key(i +
USBKBD_MODIFIER_BASE,
pressed);
}
modsdelta >>= 1;
}
}
olddown = (unsigned char*) kbd->down + USBKBD_KEYCODE_OFFSET;
newdown = (unsigned char*) down + USBKBD_KEYCODE_OFFSET;
olddown =
(unsigned char *) kbd->down + USBKBD_KEYCODE_OFFSET;
newdown = (unsigned char *) down + USBKBD_KEYCODE_OFFSET;
/* handle released keys */
for(i = 0; i < USBKBD_KEYCODE_COUNT; i++)
{
for (i = 0; i < USBKBD_KEYCODE_COUNT; i++) {
key = olddown[i];
if(USBKBD_VALID_KEYCODE(key)
&& !USBKBD_FIND_KEYCODE(newdown, key, USBKBD_KEYCODE_COUNT))
if (USBKBD_VALID_KEYCODE(key)
&& !USBKBD_FIND_KEYCODE(newdown, key,
USBKBD_KEYCODE_COUNT))
{
usb_kbd_handle_key(key, 0);
}
......@@ -160,11 +157,11 @@ usb_kbd_irq(int state, void *buffer, int len, void *dev_id)
/* handle pressed keys */
kbd->repeat_key = 0;
for(i = 0; i < USBKBD_KEYCODE_COUNT; i++)
{
for (i = 0; i < USBKBD_KEYCODE_COUNT; i++) {
key = newdown[i];
if(USBKBD_VALID_KEYCODE(key)
&& !USBKBD_FIND_KEYCODE(olddown, key, USBKBD_KEYCODE_COUNT))
if (USBKBD_VALID_KEYCODE(key)
&& !USBKBD_FIND_KEYCODE(olddown, key,
USBKBD_KEYCODE_COUNT))
{
usb_kbd_handle_key(key, 1);
kbd->repeat_key = key;
......@@ -172,11 +169,11 @@ usb_kbd_irq(int state, void *buffer, int len, void *dev_id)
}
/* set repeat timer if any keys were pressed */
if(kbd->repeat_key)
{
if (kbd->repeat_key) {
del_timer(&kbd->repeat_timer);
kbd->repeat_timer.function = usb_kbd_repeat;
kbd->repeat_timer.expires = jiffies + USBKBD_REPEAT_DELAY;
kbd->repeat_timer.expires =
jiffies + USBKBD_REPEAT_DELAY;
kbd->repeat_timer.data = (unsigned long) kbd;
kbd->repeat_timer.prev = NULL;
kbd->repeat_timer.next = NULL;
......@@ -190,8 +187,7 @@ usb_kbd_irq(int state, void *buffer, int len, void *dev_id)
return 1;
}
static void *
usb_kbd_probe(struct usb_device *dev, unsigned int i)
static void *usb_kbd_probe(struct usb_device *dev, unsigned int i)
{
struct usb_interface_descriptor *interface;
struct usb_endpoint_descriptor *endpoint;
......@@ -201,30 +197,32 @@ usb_kbd_probe(struct usb_device *dev, unsigned int i)
interface = &dev->actconfig->interface[i].altsetting[0];
endpoint = &interface->endpoint[0];
if(interface->bInterfaceClass != 3
if (interface->bInterfaceClass != 3
|| interface->bInterfaceSubClass != 1
|| interface->bInterfaceProtocol != 1)
{
|| interface->bInterfaceProtocol != 1) {
return NULL;
}
printk(KERN_INFO "USB HID boot protocol keyboard detected.\n");
kbd = kmalloc(sizeof(struct usb_keyboard), GFP_KERNEL);
if(kbd)
{
if (kbd) {
memset(kbd, 0, sizeof(*kbd));
kbd->dev = dev;
usb_set_protocol(dev, 0);
usb_set_idle(dev, 0, 0);
kbd->irqpipe = usb_rcvintpipe(dev, endpoint->bEndpointAddress);
ret = usb_request_irq(dev, kbd->irqpipe,
usb_kbd_irq, endpoint->bInterval,
kbd, &kbd->irq_handler);
kbd->irqpipe =
usb_rcvintpipe(dev, endpoint->bEndpointAddress);
ret =
usb_request_irq(dev, kbd->irqpipe, usb_kbd_irq,
endpoint->bInterval, kbd,
&kbd->irq_handler);
if (ret) {
printk(KERN_INFO "usb-keyboard failed usb_request_irq (0x%x)\n", ret);
printk(KERN_INFO
"usb-keyboard failed usb_request_irq (0x%x)\n",
ret);
goto probe_err;
}
......@@ -235,16 +233,14 @@ usb_kbd_probe(struct usb_device *dev, unsigned int i)
probe_err:
if (kbd)
kfree (kbd);
kfree(kbd);
return NULL;
}
static void
usb_kbd_disconnect(struct usb_device *dev, void *ptr)
static void usb_kbd_disconnect(struct usb_device *dev, void *ptr)
{
struct usb_keyboard *kbd = (struct usb_keyboard*) ptr;
if (kbd)
{
struct usb_keyboard *kbd = (struct usb_keyboard *) ptr;
if (kbd) {
usb_release_irq(dev, kbd->irq_handler, kbd->irqpipe);
list_del(&kbd->list);
del_timer(&kbd->repeat_timer);
......@@ -266,7 +262,8 @@ void usb_kbd_cleanup(void)
cur = head->next;
while (cur != head) {
struct usb_keyboard *kbd = list_entry(cur, struct usb_keyboard, list);
struct usb_keyboard *kbd =
list_entry(cur, struct usb_keyboard, list);
cur = cur->next;
......@@ -274,7 +271,8 @@ void usb_kbd_cleanup(void)
INIT_LIST_HEAD(&kbd->list);
if (kbd->irq_handler) {
usb_release_irq(kbd->dev, kbd->irq_handler, kbd->irqpipe);
usb_release_irq(kbd->dev, kbd->irq_handler,
kbd->irqpipe);
/* never keep a reference to a released IRQ! */
kbd->irq_handler = NULL;
}
......@@ -293,5 +291,5 @@ void cleanup_module(void)
{
usb_kbd_cleanup();
}
#endif
#endif
......@@ -164,8 +164,6 @@ static int release_mouse(struct inode * inode, struct file * file)
mouse->suspended = 0;
/* stop polling the mouse while its not in use */
usb_unlink_urb(mouse->urb);
/* never keep a reference to a released IRQ! */
mouse->irq_handle = NULL;
}
return 0;
......@@ -248,6 +246,8 @@ static ssize_t read_mouse(struct file * file, char * buffer, size_t count, loff_
static int state = 0;
struct mouse_state *mouse = &static_mouse_state;
if (!mouse->present)
return 0;
/*
* FIXME - Other mouse drivers handle blocking and nonblocking reads
* differently here...
......@@ -417,8 +417,6 @@ static void mouse_disconnect(struct usb_device *dev, void *priv)
usb_unlink_urb(mouse->urb);
}
mouse->irq_handle = NULL;
/* this might need work */
mouse->present = 0;
printk("Mouse disconnected\n");
......@@ -438,13 +436,14 @@ int usb_mouse_init(void)
struct mouse_state *mouse = &static_mouse_state;
mouse->present = mouse->active = mouse->suspended = 0;
mouse->irq_handle = NULL;
mouse->buffer=kmalloc(64,GFP_KERNEL);
if (!mouse->buffer)
return -ENOMEM;
mouse->urb=usb_alloc_urb(0);
if (!mouse->urb)
printk(KERN_DEBUG MODSTR"URB allocation failed\n");
init_waitqueue_head(&mouse->wait);
mouse->fasync = NULL;
......@@ -462,8 +461,6 @@ void usb_mouse_cleanup(void)
/* stop the usb interrupt transfer */
if (mouse->present) {
usb_unlink_urb(mouse->urb);
/* never keep a reference to a released IRQ! */
mouse->irq_handle = NULL;
}
kfree(mouse->urb);
kfree(mouse->buffer);
......
This diff is collapsed.
......@@ -75,7 +75,7 @@ typedef struct ed {
__u32 hwHeadP;
__u32 hwNextED;
struct ed *ed_prev;
struct ed * ed_prev;
__u8 int_period;
__u8 int_branch;
__u8 int_load;
......@@ -85,7 +85,7 @@ typedef struct ed {
__u16 last_iso;
struct ed * ed_rm_list;
} ed_t, * ped_t;
} ed_t;
/* TD info field */
......@@ -124,7 +124,7 @@ typedef struct ed {
#define TD_NOTACCESSED 0x0F
#define MAXPSW 8
#define MAXPSW 1
typedef struct td {
__u32 hwINFO;
......@@ -135,10 +135,10 @@ typedef struct td {
__u8 type;
__u8 index;
struct ed *ed;
struct td *next_dl_td;
purb_t urb;
} td_t, * ptd_t;
struct ed * ed;
struct td * next_dl_td;
urb_t * urb;
} td_t;
/* TD types */
......@@ -321,14 +321,14 @@ struct virt_root_hub {
/* urb */
typedef struct
{
ped_t ed;
ed_t * ed;
__u16 length; // number of tds associated with this request
__u16 td_cnt; // number of tds already serviced
int state;
void * wait;
ptd_t td[0]; // list pointer to all corresponding TDs associated with this request
td_t * td[0]; // list pointer to all corresponding TDs associated with this request
} urb_priv_t, *purb_priv_t;
} urb_priv_t;
#define URB_DEL 1
/*
......@@ -343,24 +343,24 @@ typedef struct ohci {
struct ohci_hcca hcca; /* hcca */
int irq;
struct ohci_regs *regs; /* OHCI controller's memory */
struct ohci_regs * regs; /* OHCI controller's memory */
struct list_head ohci_hcd_list; /* list of all ohci_hcd */
struct ohci *next; // chain of uhci device contexts
struct ohci * next; // chain of uhci device contexts
struct list_head urb_list; // list of all pending urbs
spinlock_t urb_list_lock; // lock to keep consistency
int ohci_int_load[32]; /* load of the 32 Interrupt Chains (for load ballancing)*/
ped_t ed_rm_list[2]; /* lists of all endpoints to be removed */
ped_t ed_bulktail; /* last endpoint of bulk list */
ped_t ed_controltail; /* last endpoint of control list */
ped_t ed_isotail; /* last endpoint of iso list */
ed_t * ed_rm_list[2]; /* lists of all endpoints to be removed */
ed_t * ed_bulktail; /* last endpoint of bulk list */
ed_t * ed_controltail; /* last endpoint of control list */
ed_t * ed_isotail; /* last endpoint of iso list */
int intrstatus;
__u32 hc_control; /* copy of the hc control reg */
struct usb_bus *bus;
struct usb_bus * bus;
struct usb_device * dev[128];
struct virt_root_hub rh;
} ohci_t, * pohci_t;
} ohci_t;
#define NUM_TDS 0 /* num of preallocated transfer descriptors */
......@@ -377,17 +377,17 @@ struct ohci_device {
/* hcd */
/* endpoint */
static int ep_link(pohci_t ohci, ped_t ed);
static int ep_unlink(pohci_t ohci, ped_t ed);
static ped_t ep_add_ed(struct usb_device * usb_dev, unsigned int pipe, int interval, int load);
static void ep_rm_ed(struct usb_device * usb_dev, ped_t ed);
static int ep_link(ohci_t * ohci, ed_t * ed);
static int ep_unlink(ohci_t * ohci, ed_t * ed);
static ed_t * ep_add_ed(struct usb_device * usb_dev, unsigned int pipe, int interval, int load);
static void ep_rm_ed(struct usb_device * usb_dev, ed_t * ed);
/* td */
static void td_fill(unsigned int info, void * data, int len, purb_t purb, int type, int index);
static void td_submit_urb(purb_t purb);
static void td_fill(unsigned int info, void * data, int len, urb_t * urb, int type, int index);
static void td_submit_urb(urb_t * urb);
/* root hub */
static int rh_submit_urb(purb_t purb);
static int rh_unlink_urb(purb_t purb);
static int rh_init_int_timer(purb_t purb);
static int rh_submit_urb(urb_t * urb);
static int rh_unlink_urb(urb_t * urb);
static int rh_init_int_timer(urb_t * urb);
#ifdef DEBUG
#define OHCI_FREE(x) kfree(x); printk("OHCI FREE: %d: %4x\n", -- __ohci_free_cnt, (unsigned int) x)
......
This diff is collapsed.
/*
* $Id: uhci-debug.c,v 1.12 1999/12/13 15:24:42 fliegl Exp $
*/
#include <linux/config.h>
#include <linux/version.h>
#include <linux/kernel.h>
#include <asm/io.h>
......
This diff is collapsed.
......@@ -2,10 +2,10 @@
#define __LINUX_UHCI_H
/*
$Id: uhci.h,v 1.28 1999/12/14 18:38:26 fliegl Exp $
$Id: uhci.h,v 1.30 1999/12/15 17:57:25 fliegl Exp $
*/
#define MODSTR "uhci: "
#define MODNAME "usb-uhci"
#define MODSTR MODNAME": "
#define VERSTR "version v0.9 time " __TIME__ " " __DATE__
/* Command register */
......@@ -145,7 +145,6 @@ typedef struct {
int short_control_packet;
} urb_priv_t, *purb_priv_t;
#ifdef VROOTHUB
struct virt_root_hub {
int devnum; /* Address of Root Hub endpoint */
void *urb;
......@@ -157,17 +156,12 @@ struct virt_root_hub {
struct timer_list rh_int_timer;
};
#endif
typedef struct uhci {
int irq;
unsigned int io_addr;
unsigned int io_size;
unsigned int maxports;
int control_pid;
int control_running;
int control_continue;
int apm_state;
struct uhci *next; // chain of uhci device contexts
......@@ -188,9 +182,7 @@ typedef struct uhci {
uhci_desc_t *chain_end;
spinlock_t qh_lock;
spinlock_t td_lock;
#ifdef VROOTHUB
struct virt_root_hub rh; //private data of the virtual root hub
#endif
} uhci_t, *puhci_t;
......@@ -201,7 +193,6 @@ typedef struct uhci {
/* ------------------------------------------------------------------------------------
Virtual Root HUB
------------------------------------------------------------------------------------ */
#ifdef VROOTHUB
/* destination of request */
#define RH_INTERFACE 0x01
#define RH_ENDPOINT 0x02
......@@ -257,8 +248,5 @@ typedef struct uhci {
#define RH_NACK 0x00
#define min(a,b) (((a)<(b))?(a):(b))
static int rh_submit_urb (purb_t purb);
static int rh_unlink_urb (purb_t purb);
#endif /* VROOTHUB */
#endif
......@@ -14,6 +14,13 @@
*
* See README.serial for more information on using this driver.
*
* version 0.2.2 (12/16/99) gkh
* Changed major number to the new allocated number. We're legal now!
*
* version 0.2.1 (12/14/99) gkh
* Fixed bug that happens when device node is opened when there isn't a
* device attached to it. Thanks to marek@webdesign.no for noticing this.
*
* version 0.2.0 (11/10/99) gkh
* Split up internals to make it easier to add different types of serial
* converters to the code.
......@@ -83,7 +90,7 @@ MODULE_PARM_DESC(product, "User specified USB idProduct");
#define PERACOM_SERIAL_CONVERTER 0x0001
#define SERIAL_MAJOR 240
#define SERIAL_MAJOR 188 /* Nice legal number now */
#define NUM_PORTS 4 /* Have to pick a number for now. Need to look */
/* into dynamically creating them at insertion time. */
......
......@@ -14,6 +14,8 @@
* Think of this as a "USB library" rather than anything else.
* It should be considered a slave, with no callbacks. Callbacks
* are evil.
*
* $Id: usb.c,v 1.37 1999/12/17 10:48:08 fliegl Exp $
*/
#ifndef EXPORT_SYMTAB
......@@ -692,7 +694,6 @@ int usb_terminate_bulk(struct usb_device *dev, void *first)
if (!urb) // none found? there is nothing to remove!
return -ENODEV;
if (urb->status!= -EINPROGRESS)
usb_unlink_urb(urb);
kfree(urb->context);
kfree(urb);
......@@ -737,7 +738,9 @@ int usb_request_irq(struct usb_device *dev, unsigned int pipe, usb_device_irq ha
unsigned int maxsze = usb_maxpacket(dev, pipe, usb_pipeout(pipe));
*handle = NULL;
printk("irq: dev:%p pipe:%08X handler:%p period:%d dev_id:%p max:%d\n", dev, pipe, handler, period, dev_id, maxsze);
//printk("irq: dev:%p pipe:%08X handler:%p period:%d dev_id:%p max:%d\n", dev, pipe, handler, period, dev_id, maxsze);
/* Check host controller's bandwidth for this int. request. */
bustime = calc_bus_time (usb_pipeslow(pipe), usb_pipein(pipe), 0,
usb_maxpacket(dev, pipe, usb_pipeout(pipe)));
......@@ -896,6 +899,7 @@ static int usb_parse_endpoint(struct usb_device *dev, struct usb_endpoint_descri
}
endpoint->extra = kmalloc(len, GFP_KERNEL);
if (!endpoint->extra) {
printk(KERN_ERR "Couldn't allocate memory for endpoint extra descriptors\n");
endpoint->extralen = 0;
......@@ -920,6 +924,7 @@ static int usb_parse_interface(struct usb_device *dev, struct usb_interface *int
interface->max_altsetting = USB_ALTSETTINGALLOC;
interface->altsetting = kmalloc(sizeof(struct usb_interface_descriptor) * interface->max_altsetting, GFP_KERNEL);
if (!interface->altsetting) {
printk(KERN_ERR "couldn't kmalloc interface->altsetting\n");
return -1;
......@@ -998,6 +1003,7 @@ static int usb_parse_interface(struct usb_device *dev, struct usb_interface *int
ifp->extralen = 0;
} else {
ifp->extra = kmalloc(len, GFP_KERNEL);
if (!ifp->extra) {
printk(KERN_ERR "couldn't allocate memory for interface extra descriptors\n");
ifp->extralen = 0;
......@@ -1119,7 +1125,7 @@ int usb_parse_configuration(struct usb_device *dev, struct usb_config_descriptor
void usb_destroy_configuration(struct usb_device *dev)
{
int c, i, j;
int c, i, j, k;
if (!dev->config)
return;
......@@ -1141,10 +1147,21 @@ void usb_destroy_configuration(struct usb_device *dev)
struct usb_interface_descriptor *as =
&ifp->altsetting[j];
if(as->extra) {
kfree(as->extra);
}
if (!as->endpoint)
break;
for(k = 0; k < as->bNumEndpoints; k++) {
if(as->endpoint[k].extra) {
kfree(as->endpoint[k].extra);
}
}
kfree(as->endpoint);
}
kfree(ifp->altsetting);
}
kfree(cf->interface);
......@@ -1594,6 +1611,7 @@ int usb_new_device(struct usb_device *dev)
dev->devnum = addr;
err = usb_set_address(dev);
if (err < 0) {
printk(KERN_ERR "usbcore: USB device not accepting new address (error=%d)\n", err);
clear_bit(dev->devnum, &dev->bus->devmap.devicemap);
......@@ -1612,6 +1630,7 @@ int usb_new_device(struct usb_device *dev)
}
err=usb_get_configuration(dev);
if (err < 0) {
printk(KERN_ERR "usbcore: unable to get configuration (error=%d)\n", err);
clear_bit(dev->devnum, &dev->bus->devmap.devicemap);
......
......@@ -26,7 +26,6 @@
*
*/
#include <linux/config.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/sched.h>
......
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