Commit 6f842b91 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 d52a86be 4945fd78
......@@ -2190,7 +2190,7 @@ S: Fullarton 5063
S: South Australia
N. Wolfgang Muees
E: wmues@nexgo.de
E: wolfgang@iksw-muees.de
D: Auerswald USB driver
N: Ian A. Murdock
......
......@@ -27,4 +27,4 @@ Future plans
============
- Connection to ISDN4LINUX (the hisax interface)
The maintainer of this driver is wmues@nexgo.de
The maintainer of this driver is wolfgang@iksw-muees.de
......@@ -1696,12 +1696,6 @@ M: dbrownell@users.sourceforge.net
L: linux-usb-devel@lists.sourceforge.net
S: Maintained
USB EHCI DRIVER
P: David Brownell
M: dbrownell@users.sourceforge.net
L: linux-usb-devel@lists.sourceforge.net
S: Maintained
USB HID/HIDBP/INPUT DRIVERS
P: Vojtech Pavlik
M: vojtech@suse.cz
......@@ -1816,7 +1810,7 @@ S: Maintained
USB AUERSWALD DRIVER
P: Wolfgang Muees
M: wmues@nexgo.de
M: wolfgang@iksw-muees.de
L: linux-usb-users@lists.sourceforge.net
L: linux-usb-devel@lists.sourceforge.net
S: Maintained
......
/*
* drivers.c
* (C) Copyright 1999 Randy Dunlap.
* (C) Copyright 1999, 2000 Thomas Sailer <sailer@ife.ee.ethz.ch>. (proc file per device)
* (C) Copyright 1999 Deti Fliegl (new USB architecture)
*
* $id$
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*************************************************************
*
* 1999-12-16: Thomas Sailer <sailer@ife.ee.ethz.ch>
* Converted the whole proc stuff to real
* read methods. Now not the whole device list needs to fit
* into one page, only the device list for one bus.
* Added a poll method to /proc/bus/usb/devices, to wake
* up an eventual usbd
* 2000-01-04: Thomas Sailer <sailer@ife.ee.ethz.ch>
* Turned into its own filesystem
*
* $Id: drivers.c,v 1.3 2000/01/11 13:58:24 tom Exp $
*/
#include <linux/fs.h>
#include <linux/gfp.h>
#include <linux/usb.h>
#include <linux/usbdevice_fs.h>
#include <linux/smp_lock.h>
#include <asm/uaccess.h>
/*****************************************************************/
/*
* Dump usb_driver_list.
*
* We now walk the list of registered USB drivers.
*/
static ssize_t usb_driver_read(struct file *file, char *buf, size_t nbytes, loff_t *ppos)
{
struct list_head *tmp = usb_driver_list.next;
char *page, *start, *end;
ssize_t ret = 0;
unsigned int pos, len;
if (*ppos < 0)
return -EINVAL;
if (nbytes <= 0)
return 0;
if (!access_ok(VERIFY_WRITE, buf, nbytes))
return -EFAULT;
if (!(page = (char*) __get_free_page(GFP_KERNEL)))
return -ENOMEM;
start = page;
end = page + (PAGE_SIZE - 100);
pos = *ppos;
lock_kernel(); /* else drivers might be unloaded */
for (; tmp != &usb_driver_list; tmp = tmp->next) {
struct usb_driver *driver = list_entry(tmp, struct usb_driver, driver_list);
int minor = driver->fops ? driver->minor : -1;
if (minor == -1)
start += sprintf (start, " %s\n", driver->name);
else if (driver->num_minors == 1)
start += sprintf (start, " %3d: %s\n", minor, driver->name);
else
start += sprintf (start, "%3d-%3d: %s\n", minor, minor + driver->num_minors - 1, driver->name);
if (start > end) {
start += sprintf(start, "(truncated)\n");
break;
}
}
unlock_kernel();
if (start == page)
start += sprintf(start, "(none)\n");
len = start - page;
if (len > pos) {
len -= pos;
if (len > nbytes)
len = nbytes;
ret = len;
if (copy_to_user(buf, page + pos, len))
ret = -EFAULT;
else
*ppos += len;
}
free_page((unsigned long)page);
return ret;
}
static loff_t usb_driver_lseek(struct file * file, loff_t offset, int orig)
{
loff_t ret;
lock_kernel();
switch (orig) {
case 0:
file->f_pos = offset;
ret = file->f_pos;
break;
case 1:
file->f_pos += offset;
ret = file->f_pos;
break;
case 2:
default:
ret = -EINVAL;
}
unlock_kernel();
return ret;
}
struct file_operations usbdevfs_drivers_fops = {
.llseek = usb_driver_lseek,
.read = usb_driver_read,
};
......@@ -876,10 +876,11 @@ static void usb_hub_port_connect_change(struct usb_hub *hubstate, int port,
* (quite rare, since most hubs have 4-6 ports).
*/
pdev = dev->parent;
if (pdev->devpath [0] != '/') /* parent not root */
if (pdev->devpath [0] != '0') /* parent not root? */
len = snprintf (dev->devpath, sizeof dev->devpath,
"%s.%d", pdev->devpath, port + 1);
else /* root == "/", root port 2 == "2", port 3 that hub "/2.3" */
/* root == "0", root port 2 == "2", port 3 that hub "2.3" */
else
len = snprintf (dev->devpath, sizeof dev->devpath,
"%d", port + 1);
if (len == sizeof dev->devpath)
......
......@@ -4,7 +4,7 @@
* inode.c -- Inode/Dentry functions for the USB device file system.
*
* Copyright (C) 2000 Thomas Sailer (sailer@ife.ee.ethz.ch)
* Copyright (c) 2001 Greg Kroah-Hartman (greg@kroah.com)
* Copyright (c) 2001,2002 Greg Kroah-Hartman (greg@kroah.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -43,11 +43,13 @@
static struct super_operations usbfs_ops;
static struct file_operations default_file_operations;
static struct inode_operations usbfs_dir_inode_operations;
static struct vfsmount *usbdevfs_mount;
static struct vfsmount *usbfs_mount;
static spinlock_t mount_lock = SPIN_LOCK_UNLOCKED;
static int mount_count; /* = 0 */
static struct dentry *devices_dentry;
static struct dentry *devices_usbdevfs_dentry;
static struct dentry *devices_usbfs_dentry;
static int num_buses; /* = 0 */
static uid_t devuid; /* = 0 */
......@@ -176,7 +178,10 @@ static int usbfs_mknod (struct inode *dir, struct dentry *dentry, int mode,
int dev)
{
struct inode *inode = usbfs_get_inode(dir->i_sb, mode, dev);
int error = -ENOSPC;
int error = -EPERM;
if (dentry->d_inode)
return -EEXIST;
if (inode) {
d_instantiate(dentry, inode);
......@@ -188,12 +193,19 @@ static int usbfs_mknod (struct inode *dir, struct dentry *dentry, int mode,
static int usbfs_mkdir (struct inode *dir, struct dentry *dentry, int mode)
{
return usbfs_mknod (dir, dentry, mode | S_IFDIR, 0);
int res;
mode = (mode & (S_IRWXUGO | S_ISVTX)) | S_IFDIR;
res = usbfs_mknod (dir, dentry, mode, 0);
if (!res)
dir->i_nlink++;
return res;
}
static int usbfs_create (struct inode *dir, struct dentry *dentry, int mode)
{
return usbfs_mknod (dir, dentry, mode | S_IFREG, 0);
mode = (mode & S_IALLUGO) | S_IFREG;
return usbfs_mknod (dir, dentry, mode, 0);
}
static inline int usbfs_positive (struct dentry *dentry)
......@@ -220,22 +232,54 @@ static int usbfs_empty (struct dentry *dentry)
}
static int usbfs_unlink (struct inode *dir, struct dentry *dentry)
{
struct inode *inode = dentry->d_inode;
down(&inode->i_sem);
dentry->d_inode->i_nlink--;
dput(dentry);
up(&inode->i_sem);
d_delete(dentry);
return 0;
}
static void d_unhash(struct dentry *dentry)
{
dget(dentry);
spin_lock(&dcache_lock);
switch (atomic_read(&dentry->d_count)) {
default:
spin_unlock(&dcache_lock);
shrink_dcache_parent(dentry);
spin_lock(&dcache_lock);
if (atomic_read(&dentry->d_count) != 2)
break;
case 2:
list_del_init(&dentry->d_hash);
}
spin_unlock(&dcache_lock);
}
static int usbfs_rmdir(struct inode *dir, struct dentry *dentry)
{
int error = -ENOTEMPTY;
struct inode * inode = dentry->d_inode;
down(&inode->i_sem);
d_unhash(dentry);
if (usbfs_empty(dentry)) {
struct inode *inode = dentry->d_inode;
lock_kernel();
inode->i_nlink--;
unlock_kernel();
dentry->d_inode->i_nlink -= 2;
dput(dentry);
inode->i_flags |= S_DEAD;
dir->i_nlink--;
error = 0;
}
up(&inode->i_sem);
if (!error)
d_delete(dentry);
dput(dentry);
return error;
}
#define usbfs_rmdir usbfs_unlink
/* default file operations */
static ssize_t default_read_file (struct file *file, char *buf,
......@@ -254,7 +298,7 @@ static loff_t default_file_lseek (struct file *file, loff_t offset, int orig)
{
loff_t retval = -EINVAL;
lock_kernel();
down(&file->f_dentry->d_inode->i_sem);
switch(orig) {
case 0:
if (offset > 0) {
......@@ -271,14 +315,14 @@ static loff_t default_file_lseek (struct file *file, loff_t offset, int orig)
default:
break;
}
unlock_kernel();
up(&file->f_dentry->d_inode->i_sem);
return retval;
}
static int default_open (struct inode *inode, struct file *filp)
static int default_open (struct inode *inode, struct file *file)
{
if (inode->u.generic_ip)
filp->private_data = inode->u.generic_ip;
file->private_data = inode->u.generic_ip;
return 0;
}
......@@ -291,11 +335,7 @@ static struct file_operations default_file_operations = {
};
static struct inode_operations usbfs_dir_inode_operations = {
.create = usbfs_create,
.lookup = simple_lookup,
.unlink = usbfs_unlink,
.mkdir = usbfs_mkdir,
.rmdir = usbfs_rmdir,
};
static struct super_operations usbfs_ops = {
......@@ -334,26 +374,30 @@ static int usbfs_fill_super(struct super_block *sb, void *data, int silent)
return 0;
}
/**
static struct dentry * get_dentry(struct dentry *parent, const char *name)
{
struct qstr qstr;
qstr.name = name;
qstr.len = strlen(name);
qstr.hash = full_name_hash(name,qstr.len);
return lookup_hash(&qstr,parent);
}
/*
* fs_create_by_name - create a file, given a name
* @name: name of file
* @mode: type of file
* @parent: dentry of directory to create it in
* @dentry: resulting dentry of file
*
* There is a bit of overhead in creating a file - basically, we
* have to hash the name of the file, then look it up. This will
* prevent files of the same name.
* We then call the proper vfs_ function to take care of all the
* file creation details.
* This function handles both regular files and directories.
*/
static int fs_create_by_name (const char *name, mode_t mode,
struct dentry *parent, struct dentry **dentry)
{
struct dentry *d = NULL;
struct qstr qstr;
int error;
int error = 0;
/* If the parent is not specified, we create it in the root.
* We need the root dentry to do this, which is in the super
......@@ -372,34 +416,17 @@ static int fs_create_by_name (const char *name, mode_t mode,
}
*dentry = NULL;
qstr.name = name;
qstr.len = strlen(name);
qstr.hash = full_name_hash(name,qstr.len);
parent = dget(parent);
down(&parent->d_inode->i_sem);
d = lookup_hash(&qstr,parent);
error = PTR_ERR(d);
if (!IS_ERR(d)) {
switch(mode & S_IFMT) {
case 0:
case S_IFREG:
error = vfs_create(parent->d_inode,d,mode);
break;
case S_IFDIR:
error = vfs_mkdir(parent->d_inode,d,mode);
break;
default:
err("cannot create special files");
}
*dentry = d;
}
*dentry = get_dentry (parent, name);
if (!IS_ERR(dentry)) {
if ((mode & S_IFMT) == S_IFDIR)
error = usbfs_mkdir (parent->d_inode, *dentry, mode);
else
error = usbfs_create (parent->d_inode, *dentry, mode);
} else
error = PTR_ERR(dentry);
up(&parent->d_inode->i_sem);
dput(parent);
return error;
}
......@@ -413,7 +440,7 @@ static struct dentry *fs_create_file (const char *name, mode_t mode,
dbg("creating file '%s'",name);
error = fs_create_by_name(name,mode,parent,&dentry);
error = fs_create_by_name (name, mode, parent, &dentry);
if (error) {
dentry = NULL;
} else {
......@@ -441,13 +468,12 @@ static void fs_remove_file (struct dentry *dentry)
if (usbfs_positive(dentry)) {
if (dentry->d_inode) {
if (S_ISDIR(dentry->d_inode->i_mode))
vfs_rmdir(parent->d_inode,dentry);
usbfs_rmdir(parent->d_inode, dentry);
else
vfs_unlink(parent->d_inode,dentry);
}
usbfs_unlink(parent->d_inode, dentry);
dput(dentry);
}
}
up(&parent->d_inode->i_sem);
}
......@@ -471,43 +497,43 @@ static struct file_system_type usbdevice_fs_type = {
.owner = THIS_MODULE,
.name = "usbdevfs",
.get_sb = usb_get_sb,
.kill_sb = kill_anon_super,
.kill_sb = kill_litter_super,
};
static struct file_system_type usb_fs_type = {
.owner = THIS_MODULE,
.name = "usbfs",
.get_sb = usb_get_sb,
.kill_sb = kill_anon_super,
.kill_sb = kill_litter_super,
};
/* --------------------------------------------------------------------- */
static int get_mount (void)
static int get_mount (struct file_system_type *fs_type, struct vfsmount **mount)
{
struct vfsmount *mnt;
spin_lock (&mount_lock);
if (usbfs_mount) {
mntget(usbfs_mount);
if (*mount) {
mntget(*mount);
++mount_count;
spin_unlock (&mount_lock);
goto go_ahead;
}
spin_unlock (&mount_lock);
mnt = kern_mount (&usbdevice_fs_type);
mnt = kern_mount (fs_type);
if (IS_ERR(mnt)) {
err ("could not mount the fs...erroring out!\n");
return -ENODEV;
}
spin_lock (&mount_lock);
if (!usbfs_mount) {
usbfs_mount = mnt;
if (!*mount) {
*mount = mnt;
++mount_count;
spin_unlock (&mount_lock);
goto go_ahead;
}
mntget(usbfs_mount);
mntget(*mount);
++mount_count;
spin_unlock (&mount_lock);
mntput(mnt);
......@@ -517,15 +543,15 @@ static int get_mount (void)
return 0;
}
static void remove_mount (void)
static void put_mount (struct vfsmount **mount)
{
struct vfsmount *mnt;
spin_lock (&mount_lock);
mnt = usbfs_mount;
mnt = *mount;
--mount_count;
if (!mount_count)
usbfs_mount = NULL;
*mount = NULL;
spin_unlock (&mount_lock);
mntput(mnt);
......@@ -534,18 +560,31 @@ static void remove_mount (void)
static int create_special_files (void)
{
struct dentry *parent;
int retval;
/* create the devices and drivers special files */
retval = get_mount ();
/* create the devices special file */
retval = get_mount (&usbdevice_fs_type, &usbdevfs_mount);
if (retval)
return retval;
devices_dentry = fs_create_file ("devices",
listmode | S_IFREG,
NULL, NULL,
&usbdevfs_devices_fops,
retval = get_mount (&usb_fs_type, &usbfs_mount);
if (retval) {
put_mount (&usbfs_mount);
return retval;
}
parent = usbfs_mount->mnt_sb->s_root;
devices_usbfs_dentry = fs_create_file ("devices", listmode | S_IFREG, parent,
NULL, &usbdevfs_devices_fops,
listuid, listgid);
if (devices_usbfs_dentry == NULL) {
err ("Unable to create devices usbfs file");
return -ENODEV;
}
parent = usbdevfs_mount->mnt_sb->s_root;
devices_usbdevfs_dentry = fs_create_file ("devices", listmode | S_IFREG, parent,
NULL, &usbdevfs_devices_fops,
listuid, listgid);
if (devices_dentry == NULL) {
if (devices_usbdevfs_dentry == NULL) {
err ("Unable to create devices usbfs file");
return -ENODEV;
}
......@@ -555,18 +594,27 @@ static int create_special_files (void)
static void remove_special_files (void)
{
if (devices_dentry)
fs_remove_file (devices_dentry);
devices_dentry = NULL;
remove_mount();
if (devices_usbdevfs_dentry)
fs_remove_file (devices_usbdevfs_dentry);
if (devices_usbfs_dentry)
fs_remove_file (devices_usbfs_dentry);
devices_usbdevfs_dentry = NULL;
devices_usbfs_dentry = NULL;
put_mount (&usbdevfs_mount);
put_mount (&usbfs_mount);
}
void usbfs_update_special (void)
{
struct inode *inode;
if (devices_dentry) {
inode = devices_dentry->d_inode;
if (devices_usbdevfs_dentry) {
inode = devices_usbdevfs_dentry->d_inode;
if (inode)
inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
}
if (devices_usbfs_dentry) {
inode = devices_usbfs_dentry->d_inode;
if (inode)
inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
}
......@@ -574,6 +622,7 @@ void usbfs_update_special (void)
void usbfs_add_bus(struct usb_bus *bus)
{
struct dentry *parent;
char name[8];
int retval;
......@@ -586,12 +635,22 @@ void usbfs_add_bus(struct usb_bus *bus)
++num_buses;
sprintf (name, "%03d", bus->busnum);
bus->dentry = fs_create_file (name,
busmode | S_IFDIR,
NULL, bus, NULL,
busuid, busgid);
if (bus->dentry == NULL)
parent = usbfs_mount->mnt_sb->s_root;
bus->usbfs_dentry = fs_create_file (name, busmode | S_IFDIR, parent,
bus, NULL, busuid, busgid);
if (bus->usbfs_dentry == NULL) {
err ("error creating usbfs bus entry");
return;
}
parent = usbdevfs_mount->mnt_sb->s_root;
bus->usbdevfs_dentry = fs_create_file (name, busmode | S_IFDIR, parent,
bus, NULL, busuid, busgid);
if (bus->usbdevfs_dentry == NULL) {
err ("error creating usbdevfs bus entry");
return;
}
usbfs_update_special();
usbdevfs_conn_disc_event();
......@@ -600,9 +659,13 @@ void usbfs_add_bus(struct usb_bus *bus)
void usbfs_remove_bus(struct usb_bus *bus)
{
if (bus->dentry) {
fs_remove_file (bus->dentry);
bus->dentry = NULL;
if (bus->usbfs_dentry) {
fs_remove_file (bus->usbfs_dentry);
bus->usbfs_dentry = NULL;
}
if (bus->usbdevfs_dentry) {
fs_remove_file (bus->usbdevfs_dentry);
bus->usbdevfs_dentry = NULL;
}
--num_buses;
......@@ -622,13 +685,22 @@ void usbfs_add_device(struct usb_device *dev)
int i_size;
sprintf (name, "%03d", dev->devnum);
dev->dentry = fs_create_file (name,
devmode | S_IFREG,
dev->bus->dentry, dev,
dev->usbfs_dentry = fs_create_file (name, devmode | S_IFREG,
dev->bus->usbfs_dentry, dev,
&usbdevfs_device_file_operations,
devuid, devgid);
if (dev->dentry == NULL)
if (dev->usbfs_dentry == NULL) {
err ("error creating usbfs device entry");
return;
}
dev->usbdevfs_dentry = fs_create_file (name, devmode | S_IFREG,
dev->bus->usbdevfs_dentry, dev,
&usbdevfs_device_file_operations,
devuid, devgid);
if (dev->usbdevfs_dentry == NULL) {
err ("error creating usbdevfs device entry");
return;
}
/* Set the size of the device's file to be
* equal to the size of the device descriptors. */
......@@ -638,8 +710,10 @@ void usbfs_add_device(struct usb_device *dev)
(struct usb_config_descriptor *)dev->rawdescriptors[i];
i_size += le16_to_cpu (config->wTotalLength);
}
if (dev->dentry->d_inode)
dev->dentry->d_inode->i_size = i_size;
if (dev->usbfs_dentry->d_inode)
dev->usbfs_dentry->d_inode->i_size = i_size;
if (dev->usbdevfs_dentry->d_inode)
dev->usbdevfs_dentry->d_inode->i_size = i_size;
usbfs_update_special();
usbdevfs_conn_disc_event();
......@@ -650,9 +724,13 @@ void usbfs_remove_device(struct usb_device *dev)
struct dev_state *ds;
struct siginfo sinfo;
if (dev->dentry) {
fs_remove_file (dev->dentry);
dev->dentry = NULL;
if (dev->usbfs_dentry) {
fs_remove_file (dev->usbfs_dentry);
dev->usbfs_dentry = NULL;
}
if (dev->usbdevfs_dentry) {
fs_remove_file (dev->usbdevfs_dentry);
dev->usbdevfs_dentry = NULL;
}
while (!list_empty(&dev->filelist)) {
ds = list_entry(dev->filelist.next, struct dev_state, list);
......
......@@ -995,7 +995,7 @@ struct usb_device *usb_alloc_dev(struct usb_device *parent, struct usb_bus *bus)
usb_bus_get(bus);
if (!parent)
dev->devpath [0] = '/';
dev->devpath [0] = '0';
dev->bus = bus;
dev->parent = parent;
atomic_set(&dev->refcnt, 1);
......
......@@ -172,7 +172,7 @@ struct aiptek_features aiptek_features[] = {
};
struct usb_device_id aiptek_ids[] = {
{USB_DEVICE(USB_VENDOR_ID_AIPTEK, 0x20), driver_info:0},
{USB_DEVICE(USB_VENDOR_ID_AIPTEK, 0x20), .driver_info = 0},
{}
};
......
......@@ -712,18 +712,6 @@ static struct file_operations dabusb_fops =
.release = dabusb_release,
};
static int dabusb_find_struct (void)
{
int u;
for (u = 0; u < NRDABUSB; u++) {
pdabusb_t s = &dabusb[u];
if (!s->usbdev)
return u;
}
return -1;
}
/* --------------------------------------------------------------------- */
static void *dabusb_probe (struct usb_device *usbdev, unsigned int ifnum,
const struct usb_device_id *id)
......
......@@ -1521,10 +1521,10 @@ static inline void usb_se401_remove_disconnected (struct usb_se401 *se401)
}
static struct usb_driver se401_driver = {
name: "se401",
id_table: device_table,
.name = "se401",
.id_table = device_table,
.probe = se401_probe,
disconnect: se401_disconnect
.disconnect = se401_disconnect
};
......
......@@ -17,11 +17,13 @@
/* Request 0x51 Image Setup */
#if 0
/* 128x98 ? 0x3180 size */
static unsigned char s128x98bw[] = {
0, 0x34, 0xC4, 0x00, 0x00, 0x00, 0, 0,
0x18, 0x02, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00
};
#endif
/* 128x122 3D80 size */
static unsigned char s128x122bw[] = {
......
......@@ -2,7 +2,7 @@
/*
* auerswald.c -- Auerswald PBX/System Telephone usb driver.
*
* Copyright (C) 2001 Wolfgang Mes (wmues@nexgo.de)
* Copyright (C) 2001 Wolfgang Mes (wolfgang@iksw-muees.de)
*
* Very much code of this driver is borrowed from dabusb.c (Deti Fliegl)
* and from the USB Skeleton driver (Greg Kroah-Hartman). Thank you.
......@@ -51,7 +51,7 @@ do { \
/*-------------------------------------------------------------------*/
/* Version Information */
#define DRIVER_VERSION "0.9.11"
#define DRIVER_AUTHOR "Wolfgang Mes <wmues@nexgo.de>"
#define DRIVER_AUTHOR "Wolfgang Mes <wolfgang@iksw-muees.de>"
#define DRIVER_DESC "Auerswald PBX/System Telephone usb driver"
/*-------------------------------------------------------------------*/
......
......@@ -152,6 +152,7 @@ static struct usb_device_id usb_klsi_table[] = {
{ USB_DEVICE(0x10bd, 0x1427) }, /* ASANTE USB To Ethernet Adapter */
{ USB_DEVICE(0x1342, 0x0204) }, /* Mobility USB-Ethernet Adapter */
{ USB_DEVICE(0x13d2, 0x0400) }, /* Shark Pocket Adapter */
{ USB_DEVICE(0x1485, 0x0001) }, /* Silicom U2E */
{ USB_DEVICE(0x1645, 0x0005) }, /* Entrega E45 */
{ USB_DEVICE(0x1645, 0x0008) }, /* Entrega USB Ethernet Adapter */
{ USB_DEVICE(0x1645, 0x8005) }, /* PortGear Ethernet Adapter */
......
......@@ -9,6 +9,10 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* (26/7/2002) ganesh
* Fixed up broken error handling in ipaq_open. Retry the "kickstart"
* packet much harder - this drastically reduces connection failures.
*
* (30/4/2002) ganesh
* Added support for the Casio EM500. Completely untested. Thanks
* to info from Nathan <wfilardo@fuse.net>
......@@ -54,6 +58,8 @@
#include "usb-serial.h"
#include "ipaq.h"
#define KP_RETRIES 100
/*
* Version Information
*/
......@@ -118,6 +124,7 @@ static int ipaq_open(struct usb_serial_port *port, struct file *filp)
struct ipaq_private *priv;
struct ipaq_packet *pkt;
int i, result = 0;
int retries = KP_RETRIES;
if (port_paranoia_check(port, __FUNCTION__)) {
return -ENODEV;
......@@ -192,31 +199,35 @@ static int ipaq_open(struct usb_serial_port *port, struct file *filp)
result = usb_submit_urb(port->read_urb, GFP_KERNEL);
if (result) {
err(__FUNCTION__ " - failed submitting read urb, error %d", result);
goto error;
}
/*
* Send out two control messages observed in win98 sniffs. Not sure what
* they do.
* Send out control message observed in win98 sniffs. Not sure what
* it does, but from empirical observations, it seems that the device
* will start the chat sequence once one of these messages gets
* through. Since this has a reasonably high failure rate, we retry
* several times.
*/
result = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), 0x22, 0x21,
0x1, 0, NULL, 0, 5 * HZ);
if (result < 0) {
err(__FUNCTION__ " - failed doing control urb, error %d", result);
while (retries--) {
result = usb_control_msg(serial->dev,
usb_sndctrlpipe(serial->dev, 0), 0x22, 0x21,
0x1, 0, NULL, 0, HZ / 10 + 1);
if (result == 0) {
return 0;
}
result = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), 0x22, 0x21,
0x1, 0, NULL, 0, 5 * HZ);
if (result < 0) {
err(__FUNCTION__ " - failed doing control urb, error %d", result);
}
return result;
err(__FUNCTION__ " - failed doing control urb, error %d", result);
goto error;
enomem:
result = -ENOMEM;
err(__FUNCTION__ " - Out of memory");
error:
ipaq_destroy_lists(port);
kfree(priv);
err(__FUNCTION__ " - Out of memory");
return -ENOMEM;
return result;
}
......
......@@ -86,7 +86,6 @@
#include <linux/module.h>
#include <linux/spinlock.h>
#include <asm/uaccess.h>
#include <linux/usb.h>
#ifdef CONFIG_USB_SERIAL_DEBUG
static int debug = 1;
......
......@@ -351,7 +351,8 @@ struct usb_bus {
int bandwidth_int_reqs; /* number of Interrupt requests */
int bandwidth_isoc_reqs; /* number of Isoc. requests */
struct dentry *dentry; /* usbfs dentry entry for the bus */
struct dentry *usbfs_dentry; /* usbfs dentry entry for the bus */
struct dentry *usbdevfs_dentry; /* usbdevfs dentry entry for the bus */
atomic_t refcnt;
};
......@@ -410,7 +411,8 @@ struct usb_device {
void *hcpriv; /* Host Controller private data */
struct list_head filelist;
struct dentry *dentry; /* usbfs dentry entry for the device */
struct dentry *usbfs_dentry; /* usbfs dentry entry for the device */
struct dentry *usbdevfs_dentry; /* usbdevfs dentry entry for the device */
/*
* Child devices - these can be either new devices
......
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