[PATCH 0/4] USB OTG Targeted Peripheral List changes
Hi all, The following patches changes the behavior of otg tpl and makes it more compliant to otg specs. The 5th patch shouldn't be applied and is against musb driver which you can find in linux-omap git tree. It's here just to show another feature that could be done with otg tpl; make it come from platform_data. Any comments are welcome. Best regards, Felipe Balbi [EMAIL PROTECTED] - To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/4] USB: OTG: Introduce new otg.c code
This patch creates moves code from otg_whitelist.h to otg.c in order to add support for configuring OTG options during the runtime in following patches. No functional changes, only clean-up whitespace on few occasions. Signed-off-by: Felipe Balbi <[EMAIL PROTECTED]> --- drivers/usb/core/Makefile|4 + drivers/usb/core/otg.c | 120 ++ drivers/usb/core/otg_whitelist.h | 102 ++-- 3 files changed, 129 insertions(+), 97 deletions(-) create mode 100644 drivers/usb/core/otg.c diff --git a/drivers/usb/core/Makefile b/drivers/usb/core/Makefile index b607870..c2e51b6 100644 --- a/drivers/usb/core/Makefile +++ b/drivers/usb/core/Makefile @@ -6,6 +6,10 @@ usbcore-objs := usb.o hub.o hcd.o urb.o message.o driver.o \ config.o file.o buffer.o sysfs.o endpoint.o \ devio.o notify.o generic.o quirks.o +ifeq ($(CONFIG_USB_OTG),y) + usbcore-objs+= otg.o +endif + ifeq ($(CONFIG_PCI),y) usbcore-objs+= hcd-pci.o endif diff --git a/drivers/usb/core/otg.c b/drivers/usb/core/otg.c new file mode 100644 index 000..11967c0 --- /dev/null +++ b/drivers/usb/core/otg.c @@ -0,0 +1,120 @@ +/* + * drivers/usb/core/otg.c + * + * Copyright (C) 2004 Texas Instruments + * + * 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. + */ + +#include +#include +#include +#include +#include + +#include "otg_whitelist.h" + +#ifdef CONFIG_USB_OTG_WHITELIST + +/* + * This OTG Whitelist is the OTG "Targeted Peripheral List". It should + * mostly use of USB_DEVICE() or USB_DEVICE_VER() entries.. + * + * YOU _SHOULD_ CHANGE THIS LIST TO MATCH YOUR PRODUCT AND ITS TESTING! + */ + +static struct usb_device_id whitelist_table [] = { + +/* hubs are optional in OTG, but very handy ... */ +{ USB_DEVICE_INFO(USB_CLASS_HUB, 0, 0), }, +{ USB_DEVICE_INFO(USB_CLASS_HUB, 0, 1), }, + +#ifdef CONFIG_USB_PRINTER /* ignoring nonstatic linkage! */ +/* FIXME actually, printers are NOT supposed to use device classes; + * they're supposed to use interface classes... + */ +{ USB_DEVICE_INFO(7, 1, 1) }, +{ USB_DEVICE_INFO(7, 1, 2) }, +{ USB_DEVICE_INFO(7, 1, 3) }, +#endif + +#ifdef CONFIG_USB_NET_CDCETHER +/* Linux-USB CDC Ethernet gadget */ +{ USB_DEVICE(0x0525, 0xa4a1), }, +/* Linux-USB CDC Ethernet + RNDIS gadget */ +{ USB_DEVICE(0x0525, 0xa4a2), }, +#endif + +#ifdefined(CONFIG_USB_TEST) || defined(CONFIG_USB_TEST_MODULE) +/* gadget zero, for testing */ +{ USB_DEVICE(0x0525, 0xa4a0), }, +#endif + +{ }/* Terminating entry */ +}; + +int is_targeted(struct usb_device *dev) +{ + struct usb_device_id*id = whitelist_table; + + /* possible in developer configs only! */ + if (!dev->bus->otg_port) + return 1; + + /* HNP test device is _never_ targeted (see OTG spec 6.6.6) */ + if ((le16_to_cpu(dev->descriptor.idVendor) == 0x1a0a && +le16_to_cpu(dev->descriptor.idProduct) == 0xbadd)) + return 0; + + /* NOTE: can't use usb_match_id() since interface caches +* aren't set up yet. this is cut/paste from that code. +*/ + for (id = whitelist_table; id->match_flags; id++) { + if ((id->match_flags & USB_DEVICE_ID_MATCH_VENDOR) && + id->idVendor != le16_to_cpu(dev->descriptor.idVendor)) + continue; + + if ((id->match_flags & USB_DEVICE_ID_MATCH_PRODUCT) && + id->idProduct != le16_to_cpu(dev->descriptor.idProduct)) + continue; + + /* No need to test id->bcdDevice_lo != 0, since 0 is never + greater than any unsigned number. */ + if ((id->match_flags & USB_DEVICE_ID_MATCH_DEV_LO) && + (id->bcdDevice_lo > le16_to_cpu(dev->descriptor.bcdDevice))) + continue; + + if ((id->match_flags & USB_DEVICE_ID_MATCH_DEV_HI) && + (id->bcdDevice_hi < le16_to_cpu(dev->descriptor.bcdDevice))) + continue; + + if ((id->match_flags & USB_DEVICE_ID_MATCH_DEV_CLASS) && + (id->bDeviceClass != dev->descriptor.bDeviceClass)) + continue; + + if ((id->match_flags & USB_DEVICE_ID_MATCH_DEV_SUBCLASS) && + (id->bDeviceSubClass!= dev->descriptor.bDeviceSubClass)) + continue; + + if ((id->match_flags & USB_DEVICE_ID_MATCH_DEV_PROTOCOL) && + (id->bDeviceProtocol != dev->descriptor.bDeviceProtocol)) + continue; + + return 1; + } + + /* add other match criteria here ... */ + + + /* OTG MESSAGE: report errors
[PATCH 2/4] USB: OTG: Make otg_get_transceiver() and otg_set_transceiver() generic
From: Tony Lidgren <[EMAIL PROTECTED]> Move otg_get_transceiver() and otg_set_transceiver() from omap specific code to common otg.c so other upcoming drivers can share them. Signed-off-by: Tony Lindgren <[EMAIL PROTECTED]> Signed-off-by: Felipe Balbi <[EMAIL PROTECTED]> --- arch/arm/plat-omap/usb.c | 32 drivers/usb/core/otg.c | 20 2 files changed, 20 insertions(+), 32 deletions(-) diff --git a/drivers/usb/core/otg.c b/drivers/usb/core/otg.c index 11967c0..531afa6 100644 --- a/drivers/usb/core/otg.c +++ b/drivers/usb/core/otg.c @@ -14,9 +14,29 @@ #include #include #include +#include #include "otg_whitelist.h" +static struct otg_transceiver *xceiv; + +int otg_set_transceiver(struct otg_transceiver *x) +{ + if (xceiv && x) + return -EBUSY; + xceiv = x; + return 0; +} +EXPORT_SYMBOL(otg_set_transceiver); + +struct otg_transceiver *otg_get_transceiver(void) +{ + if (xceiv) + get_device(xceiv->dev); + return xceiv; +} +EXPORT_SYMBOL(otg_get_transceiver); + #ifdef CONFIG_USB_OTG_WHITELIST /* diff --git a/arch/arm/plat-omap/usb.c b/arch/arm/plat-omap/usb.c index a5aedf9..5cd39fa 100644 --- a/arch/arm/plat-omap/usb.c +++ b/arch/arm/plat-omap/usb.c @@ -76,38 +76,6 @@ /*-*/ -#ifdef CONFIG_ARCH_OMAP_OTG - -static struct otg_transceiver *xceiv; - -/** - * otg_get_transceiver - find the (single) OTG transceiver driver - * - * Returns the transceiver driver, after getting a refcount to it; or - * null if there is no such transceiver. The caller is responsible for - * releasing that count. - */ -struct otg_transceiver *otg_get_transceiver(void) -{ - if (xceiv) - get_device(xceiv->dev); - return xceiv; -} -EXPORT_SYMBOL(otg_get_transceiver); - -int otg_set_transceiver(struct otg_transceiver *x) -{ - if (xceiv && x) - return -EBUSY; - xceiv = x; - return 0; -} -EXPORT_SYMBOL(otg_set_transceiver); - -#endif - -/*-*/ - #if defined(CONFIG_ARCH_OMAP_OTG) || defined(CONFIG_ARCH_OMAP15XX) static u32 __init omap_usb0_init(unsigned nwires, unsigned is_device) -- 1.5.4.rc3.24.gb53139 - To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/4] USB: OTG: Start using new otg tpl.
Introduces otg_set_error and start using it when we want to show otg_errors. Based on previous patch from Tony Lindgren <[EMAIL PROTECTED]> Signed-off-by: Felipe Balbi <[EMAIL PROTECTED]> --- drivers/usb/core/hub.c | 16 - drivers/usb/core/otg.c | 127 - drivers/usb/core/otg_whitelist.h | 20 -- drivers/usb/core/sysfs.c | 131 ++ include/linux/usb/otg.h | 19 ++ 5 files changed, 273 insertions(+), 40 deletions(-) delete mode 100644 drivers/usb/core/otg_whitelist.h diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index b04d232..0b1a7b9 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -23,6 +23,8 @@ #include #include +#include + #include #include #include @@ -1252,6 +1254,7 @@ static int usb_configure_device_otg(struct usb_device *udev) le16_to_cpu(udev->config[0].desc.wTotalLength), USB_DT_OTG, (void **) &desc) == 0) { if (desc->bmAttributes & USB_OTG_HNP) { + struct otg_transceiver *xceiv = otg_get_transceiver(); unsignedport1 = udev->portnum; dev_info(&udev->dev, @@ -1270,19 +1273,23 @@ static int usb_configure_device_otg(struct usb_device *udev) : USB_DEVICE_A_ALT_HNP_SUPPORT, 0, NULL, 0, USB_CTRL_SET_TIMEOUT); if (err < 0) { - /* OTG MESSAGE: report errors here, -* customize to match your product. -*/ + otg_set_error(xceiv, + OTG_ERR_DEVICE_NOT_RESPONDING); dev_info(&udev->dev, "can't set HNP mode; %d\n", err); bus->b_hnp_enable = 0; } + tpl_enabled = xceiv->tpl_enabled; + put_device(xceiv->dev); } } } - if (!is_targeted(udev)) { + if (err == 0) + err = otg_targeted(udev); + + if (err != OTG_ERR_DEVICE_SUPPORTED && tpl_enabled) { /* Maybe it can talk to us, though we can't talk to it. * (Includes HNP test device.) @@ -1316,6 +1323,7 @@ fail: static int usb_configure_device(struct usb_device *udev) { int err; + unsigned tpl_enabled = 0; if (udev->config == NULL) { err = usb_get_configuration(udev); diff --git a/drivers/usb/core/otg.c b/drivers/usb/core/otg.c index 531afa6..e9ece31 100644 --- a/drivers/usb/core/otg.c +++ b/drivers/usb/core/otg.c @@ -2,6 +2,7 @@ * drivers/usb/core/otg.c * * Copyright (C) 2004 Texas Instruments + * Copyright (C) 2007-2008 Nokia Corporation * * 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 @@ -9,15 +10,10 @@ * (at your option) any later version. */ -#include -#include -#include -#include +#include #include #include -#include "otg_whitelist.h" - static struct otg_transceiver *xceiv; int otg_set_transceiver(struct otg_transceiver *x) @@ -37,6 +33,22 @@ struct otg_transceiver *otg_get_transceiver(void) } EXPORT_SYMBOL(otg_get_transceiver); +/* OTG MESSAGE: report errors here, customize to match your product */ +void otg_set_error(struct otg_transceiver *x, enum usb_otg_error errno) +{ + if (!x) + return; + if (!x->tpl_enabled) + x->last_error = OTG_ERR_DEVICE_SUPPORTED; + else + x->last_error = errno; + + sysfs_notify(&x->host->root_hub->dev.kobj, NULL, "otg_last_error"); +} +EXPORT_SYMBOL(otg_set_error); + +/*-*/ + #ifdef CONFIG_USB_OTG_WHITELIST /* @@ -46,7 +58,7 @@ EXPORT_SYMBOL(otg_get_transceiver); * YOU _SHOULD_ CHANGE THIS LIST TO MATCH YOUR PRODUCT AND ITS TESTING! */ -static struct usb_device_id whitelist_table [] = { +static struct usb_device_id whitelist_table [] __initdata = { /* hubs are optional in OTG, but very handy ... */ { USB_DEVICE_INFO(USB_CLASS_HUB, 0, 0), }, @@ -76,23 +88,74 @@ static struct usb_device_id whitelist_table [] = { { }/* Terminating entry */ }; -int is_targeted(struct usb_device *dev) +struct otg_device { + struct list_headlist; + struct usb_device_idid; +}; + +static struct list_headtpl_devices; + +
[PATCH 4/4] USB: OTG: Add check for roothub initialization
From: Tony Lindgren <[EMAIL PROTECTED]> Roothub may not be initialized if no gadget is loaded on musb for example. Add check for roothub initialization. Also make comment more accurate. Signed-off-by: Tony Lindgren <[EMAIL PROTECTED]> Signed-off-by: Felipe Balbi <[EMAIL PROTECTED]> --- drivers/usb/core/otg.c | 11 ++- 1 files changed, 10 insertions(+), 1 deletions(-) diff --git a/drivers/usb/core/otg.c b/drivers/usb/core/otg.c index e9ece31..9a2ce7e 100644 --- a/drivers/usb/core/otg.c +++ b/drivers/usb/core/otg.c @@ -33,16 +33,25 @@ struct otg_transceiver *otg_get_transceiver(void) } EXPORT_SYMBOL(otg_get_transceiver); -/* OTG MESSAGE: report errors here, customize to match your product */ +/* + * OTG MESSAGE: report errors here, customize to match your product + * See also otg_last_error_show(). + */ void otg_set_error(struct otg_transceiver *x, enum usb_otg_error errno) { if (!x) return; + if (!x->tpl_enabled) x->last_error = OTG_ERR_DEVICE_SUPPORTED; else x->last_error = errno; + if (!x->host->root_hub) { + printk(KERN_WARNING "OTG: root hub not yet initialized\n"); + return; + } + sysfs_notify(&x->host->root_hub->dev.kobj, NULL, "otg_last_error"); } EXPORT_SYMBOL(otg_set_error); -- 1.5.4.rc3.24.gb53139 - To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] USB: OTG: Make otg_tpl come from platform_data
This is applicable to n8X0. It makes otg tpl come from musb_platform_data and be initialized in otg.c This provides a better code style and better handling of otg capable devices. Signed-off-by: Felipe Balbi <[EMAIL PROTECTED]> --- arch/arm/mach-omap2/board-n800-usb.c | 14 +++ drivers/usb/core/otg.c | 43 -- drivers/usb/musb/musb_core.c |4 +++ include/linux/usb/musb.h |5 include/linux/usb/otg.h |5 5 files changed, 33 insertions(+), 38 deletions(-) diff --git a/arch/arm/mach-omap2/board-n800-usb.c b/arch/arm/mach-omap2/board-n800-usb.c index 7599f64..a2ea1a0 100644 --- a/arch/arm/mach-omap2/board-n800-usb.c +++ b/arch/arm/mach-omap2/board-n800-usb.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -35,6 +36,16 @@ static int tusb_set_clock(struct clk *osc_ck, int state); # define BOARD_MODE MUSB_HOST #endif +#ifdef CONFIG_USB_OTG_WHITELIST +struct usb_device_id otg_tpl[] __initdata = { + /* Support known mass storage devices */ + { USB_DEVICE(0x0421, 0x0431), }, /* N770 */ + { USB_DEVICE(0x0421, 0x04c3), }, /* N800 */ + { USB_DEVICE(0x0421, 0x0096), }, /* RX44 */ + { } /* Terminating entry */ +}; +#endif + static struct musb_hdrc_platform_data tusb_data = { .mode = BOARD_MODE, .multipoint = 1, @@ -43,6 +54,9 @@ static struct musb_hdrc_platform_data tusb_data = { .min_power = 25, /* x2 = 50 mA drawn from VBUS as peripheral */ .power = 100, /* Max 100 mA VBUS for host mode */ .clock = "osc_ck", +#ifdef CONFIG_USB_OTG_WHITELIST + .otg_tpl= otg_tpl, +#endif }; /* diff --git a/drivers/usb/core/otg.c b/drivers/usb/core/otg.c index 9a2ce7e..8795382 100644 --- a/drivers/usb/core/otg.c +++ b/drivers/usb/core/otg.c @@ -13,6 +13,7 @@ #include #include #include +#include static struct otg_transceiver *xceiv; @@ -60,43 +61,6 @@ EXPORT_SYMBOL(otg_set_error); #ifdef CONFIG_USB_OTG_WHITELIST -/* - * This OTG Whitelist is the OTG "Targeted Peripheral List". It should - * mostly use of USB_DEVICE() or USB_DEVICE_VER() entries.. - * - * YOU _SHOULD_ CHANGE THIS LIST TO MATCH YOUR PRODUCT AND ITS TESTING! - */ - -static struct usb_device_id whitelist_table [] __initdata = { - -/* hubs are optional in OTG, but very handy ... */ -{ USB_DEVICE_INFO(USB_CLASS_HUB, 0, 0), }, -{ USB_DEVICE_INFO(USB_CLASS_HUB, 0, 1), }, - -#ifdef CONFIG_USB_PRINTER /* ignoring nonstatic linkage! */ -/* FIXME actually, printers are NOT supposed to use device classes; - * they're supposed to use interface classes... - */ -{ USB_DEVICE_INFO(7, 1, 1) }, -{ USB_DEVICE_INFO(7, 1, 2) }, -{ USB_DEVICE_INFO(7, 1, 3) }, -#endif - -#ifdef CONFIG_USB_NET_CDCETHER -/* Linux-USB CDC Ethernet gadget */ -{ USB_DEVICE(0x0525, 0xa4a1), }, -/* Linux-USB CDC Ethernet + RNDIS gadget */ -{ USB_DEVICE(0x0525, 0xa4a2), }, -#endif - -#ifdefined(CONFIG_USB_TEST) || defined(CONFIG_USB_TEST_MODULE) -/* gadget zero, for testing */ -{ USB_DEVICE(0x0525, 0xa4a0), }, -#endif - -{ }/* Terminating entry */ -}; - struct otg_device { struct list_headlist; struct usb_device_idid; @@ -220,10 +184,13 @@ targeted: static int __init tpl_init(void) { INIT_LIST_HEAD(&tpl_devices); - tpl_add_devices(whitelist_table); + if (xceiv) xceiv->tpl_enabled = 1; + if (xceiv->otg_tpl != NULL) + tpl_add_devices(xceiv->otg_tpl); + return 0; } diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index fb37e2c..cf29bde 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -1939,6 +1939,10 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) musb->set_clock = plat->set_clock; musb->min_power = plat->min_power; +#ifdef CONFIG_USB_OTG_WHITELIST + musb->xceiv.otg_tpl = plat->otg_tpl; +#endif + /* Clock usage is chip-specific ... functional clock (DaVinci, * OMAP2430), or PHY ref (some TUSB6010 boards). All this core * code does is make sure a clock handle is available; platform diff --git a/include/linux/usb/musb.h b/include/linux/usb/musb.h index d325a0d..76f21b7 100644 --- a/include/linux/usb/musb.h +++ b/include/linux/usb/musb.h @@ -7,6 +7,8 @@ * key configuration differences between boards. */ +#include + /* The USB role is defined by the connector used on the board, so long as * standards are being followed. (Developer boards sometimes won't.) */ @@ -26,6 +28,9 @@ struct musb_hdrc_platform_data { /* for clk_get() */ const char *clock; + /* OTG Targeted Peripheral List */ + struct usb_device_id*otg_tpl; + /* (HOST or OTG) switch VBUS on/off */
[PATCH] oti6858: cleanup
- Rename the copied buffer functions from pl2303 to oti6858 to avodi confusion - Initialise speeds properly - Use modern baud rate handling - Remove GSERIAL/SSERIAL ioctl hacks that reference termios unlocked Signed-off-by: Alan Cox <[EMAIL PROTECTED]> diff -u --new-file --recursive --exclude-from /usr/src/exclude linux.vanilla-2.6.24-rc8-mm1/drivers/usb/serial/oti6858.c linux-2.6.24-rc8-mm1/drivers/usb/serial/oti6858.c --- linux.vanilla-2.6.24-rc8-mm1/drivers/usb/serial/oti6858.c 2008-01-19 14:22:44.0 + +++ linux-2.6.24-rc8-mm1/drivers/usb/serial/oti6858.c 2008-01-19 15:05:07.0 + @@ -79,7 +79,7 @@ #define PL2303_BUF_SIZE1024 #define PL2303_TMP_BUF_SIZE1024 -struct pl2303_buf { +struct oti6858_buf { unsigned intbuf_size; char*buf_buf; char*buf_get; @@ -161,14 +161,14 @@ static void oti6858_shutdown(struct usb_serial *serial); /* functions operating on buffers */ -static struct pl2303_buf *pl2303_buf_alloc(unsigned int size); -static void pl2303_buf_free(struct pl2303_buf *pb); -static void pl2303_buf_clear(struct pl2303_buf *pb); -static unsigned int pl2303_buf_data_avail(struct pl2303_buf *pb); -static unsigned int pl2303_buf_space_avail(struct pl2303_buf *pb); -static unsigned int pl2303_buf_put(struct pl2303_buf *pb, const char *buf, +static struct oti6858_buf *oti6858_buf_alloc(unsigned int size); +static void oti6858_buf_free(struct oti6858_buf *pb); +static void oti6858_buf_clear(struct oti6858_buf *pb); +static unsigned int oti6858_buf_data_avail(struct oti6858_buf *pb); +static unsigned int oti6858_buf_space_avail(struct oti6858_buf *pb); +static unsigned int oti6858_buf_put(struct oti6858_buf *pb, const char *buf, unsigned int count); -static unsigned int pl2303_buf_get(struct pl2303_buf *pb, char *buf, +static unsigned int oti6858_buf_get(struct oti6858_buf *pb, char *buf, unsigned int count); @@ -203,7 +203,7 @@ struct oti6858_private { spinlock_t lock; - struct pl2303_buf *buf; + struct oti6858_buf *buf; struct oti6858_control_pkt status; struct { @@ -316,7 +316,7 @@ } priv->flags.write_urb_in_use = 1; - count = pl2303_buf_data_avail(priv->buf); + count = oti6858_buf_data_avail(priv->buf); spin_unlock_irqrestore(&priv->lock, flags); if (count > port->bulk_out_size) count = port->bulk_out_size; @@ -345,7 +345,7 @@ } spin_lock_irqsave(&priv->lock, flags); - pl2303_buf_get(priv->buf, port->write_urb->transfer_buffer, count); + oti6858_buf_get(priv->buf, port->write_urb->transfer_buffer, count); spin_unlock_irqrestore(&priv->lock, flags); port->write_urb->transfer_buffer_length = count; @@ -370,7 +370,7 @@ priv = kzalloc(sizeof(struct oti6858_private), GFP_KERNEL); if (!priv) break; - priv->buf = pl2303_buf_alloc(PL2303_BUF_SIZE); + priv->buf = oti6858_buf_alloc(PL2303_BUF_SIZE); if (priv->buf == NULL) { kfree(priv); break; @@ -391,7 +391,7 @@ for (--i; i >= 0; --i) { priv = usb_get_serial_port_data(serial->port[i]); - pl2303_buf_free(priv->buf); + oti6858_buf_free(priv->buf); kfree(priv); usb_set_serial_port_data(serial->port[i], NULL); } @@ -410,7 +410,7 @@ return count; spin_lock_irqsave(&priv->lock, flags); - count = pl2303_buf_put(priv->buf, buf, count); + count = oti6858_buf_put(priv->buf, buf, count); spin_unlock_irqrestore(&priv->lock, flags); return count; @@ -425,7 +425,7 @@ dbg("%s(port = %d)", __FUNCTION__, port->number); spin_lock_irqsave(&priv->lock, flags); - room = pl2303_buf_space_avail(priv->buf); + room = oti6858_buf_space_avail(priv->buf); spin_unlock_irqrestore(&priv->lock, flags); return room; @@ -440,7 +440,7 @@ dbg("%s(port = %d)", __FUNCTION__, port->number); spin_lock_irqsave(&priv->lock, flags); - chars = pl2303_buf_data_avail(priv->buf); + chars = oti6858_buf_data_avail(priv->buf); spin_unlock_irqrestore(&priv->lock, flags); return chars; @@ -458,7 +458,7 @@ dbg("%s(port = %d)", __FUNCTION__, port->number); - if ((!port->tty) || (!port->tty->termios)) { + if (!port->tty || !port->tty->termios) { dbg("%s(): no tty structures", __FUNCTION__); return; } @@ -468,6 +468,8 @@ *(port->tty->termios) = tty_std_termios; port->tty->termios->c_cflag = B38400 | CS8 | CREAD | HUPCL | CLOCAL; priv->flags.termios_initialized = 1; + p
Re: Periodic USB failure
On Fri, 18 Jan 2008, Jon Smirl wrote: > That's why I was somewhat suspicious that the disconnects are being > caused by software. What happens if the scheduler doesn't have the > data ready in time? Could it cause the reset I am seeing? You didn't provide enough data to really tell what was happening. Judging from the log info you did provide, it looks as though the host is resetting the hub because of problems with the periodic hub interrupt request. It doesn't look like the hub is actually disconnecting the devices. > 44100 samples * 16 bit * 2 stereo = 1.4112Mb/sec > Three channels is 4.2336Mb into a 12Mb channel. > > But 44100 doesn't divide evenly into 12Mb. So does it get into an > impossible situation of needing to transmit to all three > simultaneously and occasionally trigger the reset? You've got 44.1 32-bit samples per ms. Let's round it up to 45 samples; that makes 180 bytes per ms per output stream. Now according to Table 5-4 in the USB 2.0 spec, the USB bus can accomodate up to 5 Isochronous transfers per ms, even if each transfer contains 256 bytes. So there shouldn't be any problem managing 3 transfers of 180 bytes. However the scheduling is based on the descriptor contents, not on the actual amount of data sent. It would be worthwhile to see the descriptors for the endpoints being used. And of course, this leaves out things like the hub status transfers mentioned above. Even so, bandwidth shouldn't be a problem (those status transfers are certainly not more than 8 bytes). > There is nothing else active on the USB port. The external hub is > plugged into an ohci host. It doesn't sound like a scheduling problem. Besides, if it was the problem would show up immediately, as soon as a program tried to open the channels. It wouldn't show up at random times throughout the day. If you want to find out more about what's going wrong, enable CONFIG_USB_DEBUG and look at the full output (including debugging) from the kernel. Alan Stern - To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Periodic USB failure
Full lsusb -vv attached. I will need to figure out how to build a kernel for the thing to turn on CONFIG_USB_DEBUG. -- Jon Smirl [EMAIL PROTECTED] Bus 003 Device 002: ID 0402:5621 ALi Corp. USB 2.0 Storage Device Device Descriptor: bLength18 bDescriptorType 1 bcdUSB 2.00 bDeviceClass0 (Defined at Interface level) bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize064 idVendor 0x0402 ALi Corp. idProduct 0x5621 USB 2.0 Storage Device bcdDevice1.03 iManufacturer 0 iProduct1 USB 2.0 Storage Device iSerial 2 000420173754 bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 32 bNumInterfaces 1 bConfigurationValue 1 iConfiguration 0 bmAttributes 0xc0 Self Powered MaxPower0mA Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber0 bAlternateSetting 0 bNumEndpoints 2 bInterfaceClass 8 Mass Storage bInterfaceSubClass 6 SCSI bInterfaceProtocol 80 Bulk (Zip) iInterface 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes2 Transfer TypeBulk Synch Type None Usage Type Data wMaxPacketSize 0x0200 1x 512 bytes bInterval 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x02 EP 2 OUT bmAttributes2 Transfer TypeBulk Synch Type None Usage Type Data wMaxPacketSize 0x0200 1x 512 bytes bInterval 0 Device Qualifier (for other device speed): bLength10 bDescriptorType 6 bcdUSB 2.00 bDeviceClass0 (Defined at Interface level) bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize064 bNumConfigurations 1 Device Status: 0x0001 Self Powered Bus 003 Device 001: ID : Device Descriptor: bLength18 bDescriptorType 1 bcdUSB 2.00 bDeviceClass9 Hub bDeviceSubClass 0 Unused bDeviceProtocol 1 Single TT bMaxPacketSize064 idVendor 0x idProduct 0x bcdDevice2.06 iManufacturer 3 Linux 2.6.18-5-ixp4xx ehci_hcd iProduct2 EHCI Host Controller iSerial 1 :00:01.2 bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 25 bNumInterfaces 1 bConfigurationValue 1 iConfiguration 0 bmAttributes 0xe0 Self Powered Remote Wakeup MaxPower0mA Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber0 bAlternateSetting 0 bNumEndpoints 1 bInterfaceClass 9 Hub bInterfaceSubClass 0 Unused bInterfaceProtocol 0 Full speed hub iInterface 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes3 Transfer TypeInterrupt Synch Type None Usage Type Data wMaxPacketSize 0x0002 1x 2 bytes bInterval 12 Hub Descriptor: bLength 9 bDescriptorType 41 nNbrPorts 5 wHubCharacteristic 0x0009 Per-port power switching Per-port overcurrent protection TT think time 8 FS bits bPwrOn2PwrGood 10 * 2 milli seconds bHubContrCurrent 0 milli Ampere DeviceRemovable0x00 PortPwrCtrlMask0xff Hub Port Status: Port 1: .0503 highspeed power enable connect Port 2: . Port 3: .0100 power Port 4: .0100 power Port 5: .0100 power Device Status: 0x0001 Self Powered Bus 002 Device 111: ID 0d8c:000c C-Media Electronics, Inc. Audio Adapter Device Descriptor: bLength18 bDescriptorType 1 bcdUSB 1.10 bDeviceClass0 (Defined at Interface level) bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize064 idVendor 0x0d8c C-Media Electronics, Inc. idProduct 0x000c Audio Adapter bcdDevice
Re: Periodic USB failure
I see that the device has an audio input (not exposed externally). Do the audio inputs consume time slots and I have six streams instead of three? I'm not using the input streams. It says 100mA power and I have 2.5A available. -- Jon Smirl [EMAIL PROTECTED] - To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: udev hangs USB-storage (HP r707 camera)
Grant Grundler wrote: > https://bugs.launchpad.net/ubuntu/+source/hal/+bug/180472 ... > I have a usbmon trace for 2.6.23.13 (appended) along with dmesg output. > What I need is someone to interpret this trace, tell me what happened, > then I can work on tracking down "vol_id"'s role in this mess. You can also enable SCSI command logging. Perhaps userspace sends a specific command which offends the device (because The Other OS wouldn't send that command in this order of sequence). # echo 9216 > /sys/module/scsi_mod/parameters/scsi_logging_level That's what I wrote down on a piece of paper a long time ago; don't ask me what it means in detail. :-) -- Stefan Richter -=-==--- ---= =-=-- http://arcgraph.de/sr/ - To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: udev hangs USB-storage (HP r707 camera)
On Sun, Jan 20, 2008 at 01:53:51AM +0100, Stefan Richter wrote: > Grant Grundler wrote: > > https://bugs.launchpad.net/ubuntu/+source/hal/+bug/180472 > ... > > I have a usbmon trace for 2.6.23.13 (appended) along with dmesg output. > > What I need is someone to interpret this trace, tell me what happened, > > then I can work on tracking down "vol_id"'s role in this mess. > > You can also enable SCSI command logging. Perhaps userspace sends a > specific command which offends the device (because The Other OS wouldn't > send that command in this order of sequence). Thanks for reminding me...I had collected strace output of udev and all it's children a few days ago (probably with 2.6.22-14-generic (Ubuntu kernel). I've appended everything for PID 17972 (which is only 12k, full output is 559KB). Key bit is this: 17972 _llseek(3, 31129600, [31129600], SEEK_SET) = 0 17972 read(3, 17972 <... read resumed> 0x804dc80, 512) = -1 EIO (Input/output error) given the device reports "60801 512-byte hardware sectors (31 MB)" and "31129600/512 == 60800"...it's obvious vol_id is trying to read the last sector on the disk (I assume it's to verify the size). ISTR "reading the last sector" caused problems else where. I'll try to hunt that down. If someone could fish more details out of the usbmon trace about reading the last sector, that would be helpful. > # echo 9216 > /sys/module/scsi_mod/parameters/scsi_logging_level > That's what I wrote down on a piece of paper a long time ago; don't ask > me what it means in detail. :-) Thanks - I can sort that out later. I don't think I need it right now. cheers, grant 17963 clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0xb7e00908) = 17972 17972 close(3) = 0 17972 open("/dev/null", O_RDWR|O_LARGEFILE) = 3 17972 dup2(3, 0)= 0 17972 dup2(3, 2)= 2 17972 close(3) = 0 17972 dup2(4, 1)= 1 17972 close(4) = 0 17972 execve("/lib/udev/vol_id", ["/lib/udev/vol_id", "--export", "/dev/.tmp-8-16"], [/* 21 vars */]) = 0 17972 brk(0)= 0x804c000 17972 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) 17972 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7f52000 17972 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) 17972 open("/etc/ld.so.cache", O_RDONLY) = 3 17972 fstat64(3, {st_mode=S_IFREG|0644, st_size=62726, ...}) = 0 17972 mmap2(NULL, 62726, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb7f42000 17972 close(3) = 0 17972 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) 17972 open("/lib/libvolume_id.so.0", O_RDONLY) = 3 17972 read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\320\25"..., 512) = 512 17972 fstat64(3, {st_mode=S_IFREG|0644, st_size=27428, ...}) = 0 17972 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7f41000 17972 mmap2(NULL, 30296, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb7f39000 17972 mmap2(0xb7f4, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x6) = 0xb7f4 17972 close(3) = 0 17972 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) 17972 open("/lib/libselinux.so.1", O_RDONLY) = 3 17972 read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0 ?\0\000"..., 512) = 512 17972 fstat64(3, {st_mode=S_IFREG|0644, st_size=83516, ...}) = 0 17972 mmap2(NULL, 88980, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb7f23000 17972 mmap2(0xb7f37000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x13) = 0xb7f37000 17972 close(3) = 0 17972 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) 17972 open("/lib/libsepol.so.1", O_RDONLY) = 3 17972 read(3, "[EMAIL PROTECTED]"..., 512) = 512 17972 fstat64(3, {st_mode=S_IFREG|0644, st_size=219668, ...}) = 0 17972 mmap2(NULL, 264992, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb7ee2000 17972 mmap2(0xb7f18000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x35) = 0xb7f18000 17972 mmap2(0xb7f19000, 39712, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb7f19000 17972 close(3) = 0 17972 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) 17972 open("/lib/tls/i686/cmov/libc.so.6", O_RDONLY) = 3 17972 read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\260a\1"..., 512) = 512 17972 fstat64(3, {st_mode=S_IFREG|0644, st_size=1339816, ...}) = 0 17972 mmap2(NULL, 1349136, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb7d98000 17972 mmap2(0xb7edc000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x143) = 0xb7edc000 17972 mmap2(0xb7edf000, 9744, PROT_RE
Re: udev hangs USB-storage (HP r707 camera)
On Sat, 2008-01-19 at 19:28 -0700, Grant Grundler wrote: > On Sun, Jan 20, 2008 at 01:53:51AM +0100, Stefan Richter wrote: > > Grant Grundler wrote: > > > https://bugs.launchpad.net/ubuntu/+source/hal/+bug/180472 > > ... > > > I have a usbmon trace for 2.6.23.13 (appended) along with dmesg output. > > > What I need is someone to interpret this trace, tell me what happened, > > > then I can work on tracking down "vol_id"'s role in this mess. > > > > You can also enable SCSI command logging. Perhaps userspace sends a > > specific command which offends the device (because The Other OS wouldn't > > send that command in this order of sequence). > > Thanks for reminding me...I had collected strace output of udev and all > it's children a few days ago (probably with 2.6.22-14-generic (Ubuntu > kernel). I've appended everything for PID 17972 (which is only 12k, full > output is 559KB). Key bit is this: > 17972 _llseek(3, 31129600, [31129600], SEEK_SET) = 0 > 17972 read(3, > 17972 <... read resumed> 0x804dc80, 512) = -1 EIO (Input/output error) > > given the device reports "60801 512-byte hardware sectors (31 MB)" > and "31129600/512 == 60800"...it's obvious vol_id is trying to read > the last sector on the disk (I assume it's to verify the size). > ISTR "reading the last sector" caused problems else where. > I'll try to hunt that down. If this is the problem, it ought to be reproducible without vol_id by doing dd bs=512b if=/dev/ of=/dev/null seek=60800 count=1 There is a READ_CAPACITY bug where incompetent usb vendors misread the SCSI standard and actually report one sector more than the actual capapcity (and crash when this is accessed), but let's verify first. James - To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: udev hangs USB-storage (HP r707 camera)
On Sat, Jan 19, 2008 at 07:28:29PM -0700, Grant Grundler wrote: ... > Thanks for reminding me...I had collected strace output of udev and all > it's children a few days ago (probably with 2.6.22-14-generic (Ubuntu > kernel). I've appended everything for PID 17972 (which is only 12k, full > output is 559KB). Key bit is this: > 17972 _llseek(3, 31129600, [31129600], SEEK_SET) = 0 > 17972 read(3, > 17972 <... read resumed> 0x804dc80, 512) = -1 EIO (Input/output error) > > given the device reports "60801 512-byte hardware sectors (31 MB)" > and "31129600/512 == 60800"...it's obvious vol_id is trying to read > the last sector on the disk (I assume it's to verify the size). > ISTR "reading the last sector" caused problems else where. > I'll try to hunt that down. That was too easy. http://www.cs.helsinki.fi/linux/linux-kernel/2001-23/0960.html Is 1K alignment still a problem? Or I have to add the HP r707 to some list per comments from this patch: http://www.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.17-rc2/2.6.17-rc2-mm1/broken-out/git-ieee1394.patch + * - fix capacity + * Tell sd_mod to correct the last sector number reported by read_capacity. + * Avoids access beyond actual disk limits on devices with an off-by-one bug. + * Don't use this with devices which don't have this bug. hunting more... grant - To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: udev hangs USB-storage (HP r707 camera)
On Sat, Jan 19, 2008 at 08:56:31PM -0600, James Bottomley wrote: > > it's children a few days ago (probably with 2.6.22-14-generic (Ubuntu > > kernel). I've appended everything for PID 17972 (which is only 12k, full > > output is 559KB). Key bit is this: > > 17972 _llseek(3, 31129600, [31129600], SEEK_SET) = 0 > > 17972 read(3, > > 17972 <... read resumed> 0x804dc80, 512) = -1 EIO (Input/output error) > > > > given the device reports "60801 512-byte hardware sectors (31 MB)" > > and "31129600/512 == 60800"...it's obvious vol_id is trying to read > > the last sector on the disk (I assume it's to verify the size). > > ISTR "reading the last sector" caused problems else where. > > I'll try to hunt that down. > > If this is the problem, it ought to be reproducible without vol_id by > doing > > dd bs=512b if=/dev/ of=/dev/null seek=60800 count=1 [EMAIL PROTECTED]:~ # dd bs=512b if=/dev/sda of=/dev/null seek=60800 count=1 1+0 records in 1+0 records out 262144 bytes (262 kB) copied, 0.433933 seconds, 604 kB/s but since 512B is the default (I thought), I tried: [EMAIL PROTECTED]:~ # dd if=/dev/sda of=/dev/null seek=60800 count=1 1+0 records in 1+0 records out 512 bytes (512 B) copied, 0.0239289 seconds, 21.4 kB/s and got different outputwth? Oh...and you mean "skip", not "seek"...no wonder that worked. [EMAIL PROTECTED]:~ # strace -o strace-dd-HPr707.out dd if=/dev/sda of=/dev/null skip=60800 count=1 dd: reading `/dev/sda': Input/output error 0+0 records in 0+0 records out 0 bytes (0 B) copied, 55.7303 seconds, 0.0 kB/s dmesg output: Jan 19 19:08:12 localhost kernel: usb 1-1.1.4: reset full speed USB device using uhci_hcd and address 8 Jan 19 19:08:37 localhost last message repeated 3 times Jan 19 19:08:37 localhost kernel: sd 3:0:0:0: scsi: Device offlined - not ready after error recovery Jan 19 19:08:37 localhost kernel: sd 3:0:0:0: [sda] Result: hostbyte=DID_ABORT driverbyte=DRIVER_OK,SUGGEST_OK Jan 19 19:08:37 localhost kernel: end_request: I/O error, dev sda, sector 60800 > There is a READ_CAPACITY bug where incompetent usb vendors misread the > SCSI standard and actually report one sector more than the actual > capacity (and crash when this is accessed), but let's verify first. This seems to be exactly the case. What's the work around? thanks, grant - To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: udev hangs USB-storage (HP r707 camera)
On Sat, Jan 19, 2008 at 08:10:08PM -0700, Grant Grundler wrote: > [EMAIL PROTECTED]:~ # strace -o strace-dd-HPr707.out dd if=/dev/sda > of=/dev/null skip=60800 count=1 > dd: reading `/dev/sda': Input/output error > 0+0 records in > 0+0 records out > 0 bytes (0 B) copied, 55.7303 seconds, 0.0 kB/s BTW, here's the relevant bit of the strace output: open("/dev/sda", O_RDONLY|O_LARGEFILE) = 0 _llseek(0, 0, [0], SEEK_CUR)= 0 close(1)= 0 open("/dev/null", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0666) = 1 rt_sigaction(SIGUSR1, NULL, {SIG_DFL}, 8) = 0 rt_sigaction(SIGINT, NULL, {SIG_DFL}, 8) = 0 rt_sigaction(SIGUSR1, {0x80493a0, [INT USR1], 0}, NULL, 8) = 0 rt_sigaction(SIGINT, {0x8049390, [INT USR1], SA_NOMASK|SA_ONESHOT}, NULL, 8) = 0 clock_gettime(CLOCK_MONOTONIC, {70667, 216812381}) = 0 ioctl(0, MGSL_IOCSTXIDLE or MTIOCGET or SNDCTL_MIDI_MPUCMD, 0xbf8e31d0) = -1 EIN VAL (Invalid argument) _llseek(0, 31129600, [31129600], SEEK_CUR) = 0 read(0, 0x8059000, 512) = -1 EIO (Input/output error) thanks, grant - To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: udev hangs USB-storage (HP r707 camera)
On Sat, 2008-01-19 at 20:10 -0700, Grant Grundler wrote: > On Sat, Jan 19, 2008 at 08:56:31PM -0600, James Bottomley wrote: > > > > it's children a few days ago (probably with 2.6.22-14-generic (Ubuntu > > > kernel). I've appended everything for PID 17972 (which is only 12k, full > > > output is 559KB). Key bit is this: > > > 17972 _llseek(3, 31129600, [31129600], SEEK_SET) = 0 > > > 17972 read(3, > > > 17972 <... read resumed> 0x804dc80, 512) = -1 EIO (Input/output error) > > > > > > given the device reports "60801 512-byte hardware sectors (31 MB)" > > > and "31129600/512 == 60800"...it's obvious vol_id is trying to read > > > the last sector on the disk (I assume it's to verify the size). > > > ISTR "reading the last sector" caused problems else where. > > > I'll try to hunt that down. > > > > If this is the problem, it ought to be reproducible without vol_id by > > doing > > > > dd bs=512b if=/dev/ of=/dev/null seek=60800 count=1 > > [EMAIL PROTECTED]:~ # dd bs=512b if=/dev/sda of=/dev/null seek=60800 count=1 > 1+0 records in > 1+0 records out > 262144 bytes (262 kB) copied, 0.433933 seconds, 604 kB/s > > but since 512B is the default (I thought), I tried: > [EMAIL PROTECTED]:~ # dd if=/dev/sda of=/dev/null seek=60800 count=1 > 1+0 records in > 1+0 records out > 512 bytes (512 B) copied, 0.0239289 seconds, 21.4 kB/s > > and got different outputwth? > > Oh...and you mean "skip", not "seek"...no wonder that worked. > > [EMAIL PROTECTED]:~ # strace -o strace-dd-HPr707.out dd if=/dev/sda > of=/dev/null skip=60800 count=1 > dd: reading `/dev/sda': Input/output error > 0+0 records in > 0+0 records out > 0 bytes (0 B) copied, 55.7303 seconds, 0.0 kB/s > > > dmesg output: > Jan 19 19:08:12 localhost kernel: usb 1-1.1.4: reset full speed USB device > using uhci_hcd and address 8 > Jan 19 19:08:37 localhost last message repeated 3 times > Jan 19 19:08:37 localhost kernel: sd 3:0:0:0: scsi: Device offlined - not > ready after error recovery > Jan 19 19:08:37 localhost kernel: sd 3:0:0:0: [sda] Result: > hostbyte=DID_ABORT driverbyte=DRIVER_OK,SUGGEST_OK > Jan 19 19:08:37 localhost kernel: end_request: I/O error, dev sda, sector > 60800 > > > > There is a READ_CAPACITY bug where incompetent usb vendors misread the > > SCSI standard and actually report one sector more than the actual > > capacity (and crash when this is accessed), but let's verify first. > > This seems to be exactly the case. > What's the work around? Add the device to drivers/usb/storage/unusual_devs.h with US_FL_FIX_CAPACITY. You'll need to know it's USB ids as well for this file. James - To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
USB_SC_* vs USB_PR_* in unusual_dev.h
Hi, I'm slightly confused by this declaration in drivers/usb/storage/usb.c: #define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \ vendorName, productName,useProtocol, useTransport, \ initFunction, flags) \ ... and in unusual.h: UAL_DEV( 0x03eb, 0x2002, 0x0100, 0x0100, "ATMEL", "SND1 Storage", US_SC_DEVICE, US_PR_DEVICE, NULL, US_FL_IGNORE_RESIDUE), So US_SC_DEVICE ("Sub Classes" per include/linux/usb_usual.h) is used as a wild card for useProtocol and US_PR_DEVICE ("Protocols") is the wildcard for useTransport? Shouldn't US_PR_DEVICE be used for useProtocol? The two values are the same but it seems like asking for trouble to not align the field/constant names correctly. Seems like someone cloning an entry and replacing the wildcard will put the new value in the wrong place. thanks, grant - To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] [2.6.23.13] udev hangs USB-storage (HP r707 camera)
On Sat, Jan 19, 2008 at 10:11:05PM -0600, James Bottomley wrote: ... > Add the device to drivers/usb/storage/unusual_devs.h with > US_FL_FIX_CAPACITY. You'll need to know it's USB ids as well for this > file. James, Thanks! Patch below (for Alan) works for me. Jan 19 20:50:17 localhost kernel: USB Mass Storage support registered. Jan 19 20:50:22 localhost kernel: scsi scan: INQUIRY result too short (5), using 36 Jan 19 20:50:22 localhost kernel: scsi 0:0:0:0: Direct-Access HP PhotoSmart R707 A001 PQ: 0 ANSI: 0 Jan 19 20:50:22 localhost kernel: sd 0:0:0:0: [sda] 60800 512-byte hardware sectors (31 MB) Jan 19 20:50:22 localhost kernel: sd 0:0:0:0: [sda] Write Protect is off Jan 19 20:50:22 localhost kernel: sd 0:0:0:0: [sda] 60800 512-byte hardware sectors (31 MB) Jan 19 20:50:22 localhost kernel: sd 0:0:0:0: [sda] Write Protect is off Jan 19 20:50:22 localhost kernel: sda: sda1 Jan 19 20:50:22 localhost kernel: sd 0:0:0:0: [sda] Attached SCSI removable disk FTR, previous sd output was showing 60801 sectors. [EMAIL PROTECTED]:~ # lsusb Bus 001 Device 007: ID 03f0:4002 Hewlett-Packard PhotoSmart 720 / PhotoSmart 935 (storage) Bus 001 Device 004: ID 046d:c030 Logitech, Inc. iFeel Mouse Bus 001 Device 003: ID 0451:1446 Texas Instruments, Inc. TUSB2040/2070 Hub Bus 001 Device 002: ID 7fff:bfff Bus 001 Device 001: ID : Thanks! grant Commit Log entry: Add "FIX_CAPACITY" entry for HP Photosmart r707 Camera in "Disk" mode. Camera will wedge when /lib/udev/vol_id attempts to access the last sector, EIO gets reported to dmesg, and block device is marked "offline" (it is). Reproduced vol_id behavior with: "dd if=/dev/sda of=/dev/null skip=60800 count=1" With patch, linux now reports 60800 sectors and udev is happy. email thread reference: http://marc.info/?t=12007648332&r=1&w=2 Signed-off-by: Grant Grundler <[EMAIL PROTECTED]> --- linux-2.6.23.13/drivers/usb/storage/unusual_devs.h 2008-01-19 19:59:15.0 -0800 +++ linux-2.6.23-GGG/drivers/usb/storage/unusual_devs.h 2008-01-19 20:40:40.0 -0800 @@ -86,6 +86,14 @@ US_SC_8070, US_PR_USBAT, init_usbat_cd, 0), #endif +/* Reported by Grant Grundler <[EMAIL PROTECTED]> + * HP r707 camera in "Disk" mode with 2.00.23 or 2.00.24 firmware. + */ +UNUSUAL_DEV( 0x03f0, 0x4002, 0x0001, 0x0001, + "HP", + "PhotoSmart R707", + US_SC_DEVICE, US_PR_DEVICE, NULL, US_FL_FIX_CAPACITY), + /* Reported by Sebastian Kapfer <[EMAIL PROTECTED]> * and Olaf Hering <[EMAIL PROTECTED]> (different bcd's, same vendor/product) * for USB floppies that need the SINGLE_LUN enforcement. - To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: USB_SC_* vs USB_PR_* in unusual_dev.h
On Sat, Jan 19, 2008 at 09:25:57PM -0700, Grant Grundler wrote: > Hi, > I'm slightly confused by this declaration in drivers/usb/storage/usb.c: > #define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \ > vendorName, productName,useProtocol, useTransport, \ > initFunction, flags) \ > ... > > and in unusual.h: > UAL_DEV( 0x03eb, 0x2002, 0x0100, 0x0100, > "ATMEL", > "SND1 Storage", > US_SC_DEVICE, US_PR_DEVICE, NULL, > US_FL_IGNORE_RESIDUE), > > So US_SC_DEVICE ("Sub Classes" per include/linux/usb_usual.h) is used as a > wild card for useProtocol and US_PR_DEVICE ("Protocols") is the wildcard for > useTransport? No, they aren't wildcards. The value means "use whatever the device presents". It's not used as a matching parameter. Matching only happens on VID/PID and revision. Also, the naming is goofy for a reason. The USB spec calls the numbers "SubClass" and "Protocol". However, the way they are used, the SubClass defines the protocol (i.e. language) the device uses; the "Protocol" defines the transport (i.e. how messages are packed for exchange). There is no USB-spec field named 'Transport'. Matt -- Matthew Dharm Home: [EMAIL PROTECTED] Maintainer, Linux USB Mass Storage Driver You were using cheat codes too. You guys suck. -- Greg to General Studebaker User Friendly, 12/16/1997 pgpAEZt1U8r7p.pgp Description: PGP signature