From owner-freebsd-usb@FreeBSD.ORG Sun Aug 28 09:13:42 2011 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 33AE4106564A for ; Sun, 28 Aug 2011 09:13:41 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe08.c2i.net [212.247.154.226]) by mx1.freebsd.org (Postfix) with ESMTP id B3B118FC12 for ; Sun, 28 Aug 2011 09:13:40 +0000 (UTC) X-Cloudmark-Score: 0.000000 [] X-Cloudmark-Analysis: v=1.1 cv=ZrWDMTID0AMW4DNRKF44fvigJaUxxg2ESvddpUoMqyA= c=1 sm=1 a=SvYTsOw2Z4kA:10 a=vol9jpP2GJ4A:10 a=WQU8e4WWZSUA:10 a=8nJEP1OIZ-IA:10 a=CL8lFSKtTFcA:10 a=i9M/sDlu2rpZ9XS819oYzg==:17 a=wNzisysrWioXDslotMoA:9 a=wPNLvfGTeEIA:10 a=i9M/sDlu2rpZ9XS819oYzg==:117 Received: from [188.126.198.129] (account mc467741@c2i.net HELO laptop002.hselasky.homeunix.org) by mailfe08.swip.net (CommuniGate Pro SMTP 5.2.19) with ESMTPA id 172024863; Sun, 28 Aug 2011 11:13:37 +0200 From: Hans Petter Selasky To: freebsd-usb@freebsd.org Date: Sun, 28 Aug 2011 11:11:05 +0200 User-Agent: KMail/1.13.5 (FreeBSD/8.2-STABLE; KDE/4.4.5; amd64; ; ) References: <201108272342.RAA02535@lariat.net> In-Reply-To: <201108272342.RAA02535@lariat.net> X-Face: *nPdTl_}RuAI6^PVpA02T?$%Xa^>@hE0uyUIoiha$pC:9TVgl.Oq, NwSZ4V"|LR.+tj}g5 %V,x^qOs~mnU3]Gn; cQLv&.N>TrxmSFf+p6(30a/{)KUU!s}w\IhQBj}[g}bj0I3^glmC( :AuzV9:.hESm-x4h240C`9=w MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201108281111.05988.hselasky@c2i.net> Cc: Brett Glass Subject: Re: System hanging, error messages with USB drive on FreeBSD 8.1 X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Aug 2011 09:13:42 -0000 On Sunday 28 August 2011 01:42:27 Brett Glass wrote: > I'm working with a FreeBSD 8.1-RELEASE/amd64 machine that's > attempting to write data to an ordinary Kingston 8 GB microSD card. > The card has been inserted into its USB adapter and plugged into a > USB port on the machine. The system is locking up repeatedly with > messages that say > > (da1:umass-sim1:1:0:0): SYNCHRONIZE CACHE(10). CDB: 35 0 0 0 0 0 0 0 0 0 > (da1:umass-sim1:1:0:0): SCSI sense: Error code 0x52 > > A Web search reveals that problems like this have cropped up for > many, many FreeBSD users as far back as 4.x. But I can't seem to > find any solution (which amazes me; if there's a bug, one would > think it would have gotten some attention). Do I have to abandon > the use of FreeBSD with USB thumb drives (or maybe with USB > altogether)? Hope not, but I may have to if I can't get this fixed. > > --Brett Glass Hi, Can try first using: usbconfig -d X.Y add_quirk UQ_MSC_NO_SYNC_CACHE Then replug your device. --HPS From owner-freebsd-usb@FreeBSD.ORG Mon Aug 29 11:07:20 2011 Return-Path: Delivered-To: freebsd-usb@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2DA7D106566B for ; Mon, 29 Aug 2011 11:07:20 +0000 (UTC) (envelope-from owner-bugmaster@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 1C0EA8FC24 for ; Mon, 29 Aug 2011 11:07:20 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p7TB7Kcr089435 for ; Mon, 29 Aug 2011 11:07:20 GMT (envelope-from owner-bugmaster@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p7TB7JAq089433 for freebsd-usb@FreeBSD.org; Mon, 29 Aug 2011 11:07:19 GMT (envelope-from owner-bugmaster@FreeBSD.org) Date: Mon, 29 Aug 2011 11:07:19 GMT Message-Id: <201108291107.p7TB7JAq089433@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: gnats set sender to owner-bugmaster@FreeBSD.org using -f From: FreeBSD bugmaster To: freebsd-usb@FreeBSD.org Cc: Subject: Current problem reports assigned to freebsd-usb@FreeBSD.org X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Aug 2011 11:07:20 -0000 Note: to view an individual PR, use: http://www.freebsd.org/cgi/query-pr.cgi?pr=(number). The following is a listing of current problems submitted by FreeBSD users. These represent problem reports covering all versions including experimental development code and obsolete releases. S Tracker Resp. Description -------------------------------------------------------------------------------- o usb/159611 usb [PATCH] USB stick extrememory Snippy needs quirks o usb/159274 usb USB 3.0 Etron EJ168A does not work. f usb/159191 usb [fusefs-ntfs] write on fusefs-ntfs mounted partition r o usb/157376 usb LaCie USB disk not recognized o usb/156898 usb [keyboard] usb keyboard does not work while boot (ps2 o usb/156735 usb Need Quirk for Goflex USB Disk Drives o usb/156725 usb USB stack stall cause complete system input loss o usb/156596 usb [ehci] Extremely high interrupt rate on ehci/uhci IRQ1 o usb/156000 usb rum(4) Fatal trap 18: integer divide fault while in ke o usb/155996 usb NanoBSD not booted as Disk o usb/155784 usb Problem with Transcend StoreJet 25M3 (2AJ1) on Asus M2 o usb/155663 usb [usbdevs] [patch] Add support for Supertop Nano 1GB US o usb/155496 usb [usb][patch] support BUFFALO WLI-U2-SG54HG wireless o usb/154753 usb [usbdevs] [patch] Support for Qualcomm USB modem/stora o usb/154710 usb [ugen] Conexant USB Modem is not working in 8.x. In 7. o usb/154506 usb [umass] Copying dir with large files makes FreeBSD loa o usb/154192 usb [umass] In Garmin Oregon GPS, only the first umass dev o i386/153851 usb [keyboard] keyboard issues on new Intel Mother boards. o usb/153703 usb [keyboard] My USB keyboard can not be used in 8-STABLE o usb/153609 usb [zyd] [panic] kernel: Fatal trap 12: page fault while o usb/153599 usb [usbdevs] [patch] Feiya Elango USB MicroSD reader sync o usb/153149 usb [umass] USB stick quirk regression [regression] o usb/152075 usb [usb8] [ehci] [request] Add quirk for CS5536 USB o usb/150892 usb [zyd] Whenever network contacted in any shape, way or o usb/150189 usb [run] [usb8] [patch] if_run appears to corrupt IP traf p usb/149934 usb [patch] [usb8] Transcend JetFlash V85 poor performance p usb/149900 usb [uftdi] [patch] FreeBSD 8.1 uftdi patch to support usb p usb/149764 usb [u3g] [patch] usbdevs update: Huawei K3765 3G modem o usb/149283 usb [uftdi] avrdude unable to talk to Arduino board (via u o usb/149162 usb [ural] ASUS WL-167g doesn't work in 8.1 (continue of 1 s usb/148702 usb [usb8] [request] IO DATA USB-RSAQ5 support on FreeBSD- o usb/148080 usb usbconfig(8) sometimes does not turn off the device o usb/147516 usb [umass] [usb67] kernel unable to deal with Olympus USB o i386/147475 usb [install] FreeBSD 8.x does not install on ASUS K8N4-E p usb/146871 usb [usbdevs] [usb8] [patch] provide descriprive string fo o usb/146840 usb [hang] FreeBSD 7.2 / 7.3 / 8.0 hang at startup after e o usb/146153 usb [axe] [usb8] Hosts in network doesn't receive any pack f usb/146054 usb [urtw] [usb8] urtw driver potentially out of date f usb/145513 usb [usb8] New USB stack: no new devices after forced usb p usb/145455 usb [usb8] [patch] USB debug support cannot be disabled o usb/145415 usb [umass] [usb8] USB card reader does not create slices a usb/145184 usb GENERIC can't mount root from USB on Asus EEE o usb/145165 usb [keyboard] [usb8] ukbd_set_leds_callback: error=USB_ER f kern/144938 usb [keyboard] [boot] Boot Failure with Apple (MB869LL/A) o usb/144387 usb [run] [panic] if_run panic o usb/144043 usb [umass] [usb8] USB DLT tape drive throws random errors a usb/143790 usb [boot] [cam] can not boot from usb hdd f usb/143620 usb [cdce] [usb8] the module if_cdce doesn't support my Op f usb/143294 usb [usb8] copying process stops at some time (10 - 50 sec o usb/143286 usb [ukbd] [usb8] [boot] boot failures on RELENG_8 system p usb/143186 usb [usbdevs] [usb8] [patch] add USB device IDs for Google a usb/143139 usb [umass] [usb8] [patch] Quirk for Century EX35SW4_SB4 J o usb/143045 usb [umass] [usb8] [patch] mounting Fujitsu 2600Z camera d o usb/142991 usb [uftdi] [usb67] [patch] Patch to add Crystalfontz 533 f usb/142989 usb [usb8] canon eos 50D attaches but detaches after few s f usb/142957 usb [umass] [usb8] [patch] patch for USB disk SYNCHRONIZE o usb/142719 usb [urtw] [usb8] AirLive WL-1600USB (RTL8187L chipset) fa o usb/142713 usb [usb67] [panic] Kernel Panik when connecting an IPhone f usb/142276 usb [umass] [usb8] Cache Synchronization Error with Olympu o usb/142229 usb [ums] [usb8] [hang] connecting a USB mouse to a Dell P f usb/141680 usb [uath] [usb8] Netgear WG111T not working with uath dri o usb/141664 usb [pcm] [usb8] Logitech USB microphone failure [regressi o usb/141474 usb [boot] [usb8] FreeBSD 8.0 can not install from USB CDR o usb/141327 usb [ukbd] [usb67] USB kbd not working with 7.1+PAE on IBM o usb/141212 usb [ukbd] [usb8] ukbd_set_leds_callback:700: error=USB_ER o kern/141011 usb [usb8] Encrypted root, geli password at boot; enter ke o usb/140920 usb [install] [usb8] USB based install fails on 8.0-RELEAS o usb/140893 usb [urtw] [usb8] WPA2 not working on rtl8187b o kern/140849 usb [ums] [usb8] USB mouse doesn't work under FreeBSD 8.0- a usb/140810 usb [uftdi] [usb8] 8.X copy and paste problem / tty overfl o usb/140477 usb [umass] [usb8] [patch] allow boot-time attachment of d o usb/140236 usb [msdosfs] [usb8] Labels wiped on external Journaled US o usb/140160 usb [usb8] [acpi] USB ports are no longer "active" after A s usb/139990 usb [panic] [patch] [usb67] Kernel frequently panics after a usb/139598 usb [umass] [usb8] CAM reports "xptioctl: put "device pass o usb/139243 usb [uhci] [usb67] unplug prolific USB serial -> uhci_abor f usb/138882 usb [ohci] [panic] [usb67] Can't install FreeBSD 7.2 due t o usb/138798 usb [boot] [usb8] 8.0-BETA4 can't boot from USB flash driv o usb/138659 usb [usb8][uftdi] driver broken in RELENG_8/CURRENT s usb/138570 usb [usb67] [panic] USB mass device panics current 7.2-STA o usb/138175 usb [usb67] [boot] System cannot boot, when USB reader wit o usb/138124 usb [snd_uaudio] [usb8] Axed uaudio functionality in the u o usb/138119 usb [usb67] [usb8] MultiBay CDROM (probably on USB bus) is o usb/137872 usb [usb67] [boot] slow booting on usb flash drive o usb/137806 usb [ukbd] [usb67] USB keyboard doesn't work until it's un o usb/137763 usb [usb67][ukbd] Logitech wireless keyboard media keys no o usb/137377 usb [usb8] request support for Huawei E180 o usb/137341 usb [usb8][rum] driver if_rum doesn't work at all and thro f usb/137190 usb [usb8][patch] inhibit spurious button releases for som o usb/137189 usb [usb8][patch] create and use sysctl nodes for HID repo p usb/137188 usb [usb8][patch] correctly handle USB report descriptors o usb/137129 usb [ums] [usb8] SteelSeries Ikari USB laser mouse not att p usb/136761 usb [usbdevs][usb67][patch] Teach usbdevs / u3g(4) about H o usb/135938 usb [aue] [usb67] aue driver only passes traffic in promis o usb/135542 usb [keyboard] boot loader does not work with a usb keyboa o usb/135348 usb [umass] [patch] USB Drive Hangs with ZFS (JMicron USB2 o usb/135206 usb machine reboots when inserted USB device f usb/135200 usb SAMSUNG i740 usb mass: Synchronize cache failed, statu o usb/135182 usb UMASS quirk - Olympus FE20 camera o usb/134950 usb Lowering DTR for USB-modem via ubsa is not possible o usb/134299 usb Kernel Panic plugging in MF626 USB UMTS Stick u3g o usb/134193 usb System freeze on usb MP3 player insertion o usb/134085 usb [umass] Adding usb quirk for Sony USB flash drive o usb/133989 usb [usb8] [ukbd] USB keyboard dead at mountroot> prompt o usb/133712 usb [ural] [patch] RE: Fixed an issue with ural(4) that wa o usb/133390 usb umass crashes system in 7.1 when Olympus D-540 attache o usb/133296 usb [rum] driver not working properly in hostap mode o usb/132594 usb USB subsystem causes page fault and crashes o usb/132080 usb [patch] [usb] [rum] [panic] Kernel panic after NOMEM c o usb/132066 usb [ukbd] Keyboard failure USB keyboard DELL 760 o usb/132036 usb [panic] page fault when connecting Olympus C740 camera o usb/131583 usb [umass] Failure when detaching umass Device o usb/131576 usb [aue] ADMtek USB To LAN Converter can't send data o usb/131521 usb Registering Belkin UPS to usb_quirks.c p usb/131123 usb [patch] [usb67] re-add UQ_ASSUME_CM_OVER_DATA USB quir o usb/131074 usb no run-time detection of usb devices plugged into exte o usb/130736 usb Page fault unplugging USB stick o usb/130230 usb [patch] [quirk] [usb67] [usb] [cam] [umass] Samsung El o usb/130208 usb Boot process severely hampered by umass0 error o usb/130122 usb [usb8] DVD drive detects as 'da' device f usb/129766 usb [usb] [panic] plugging in usb modem HUAWEI E226 panics o usb/129500 usb [umass] [panic] FreeBSD Crashes when connecting SanDis o usb/129311 usb [usb] [panic] Instant crash with an USB card reader s usb/128990 usb [usb] u3g does not handle RTS/CTS available on for exa o usb/128977 usb [usb67] [patch] uaudio is not full duplex p usb/128803 usb [usbdevs] [patch] Quirk for I-Tuner Networks USBLCD4X2 o usb/128485 usb [umodem] [patch] Nokia N80 modem support o usb/128425 usb [umass] Cannot Connect Maxtor Onetouch 4 USB drive o usb/128418 usb [panic] [rum] loading if_rum causes panic, looks like o usb/127926 usb [boot] USB Timeout during bootup s usb/127453 usb [request] ubsa, uark, ubser, uftdi, and friends should o usb/127342 usb [boot] [panic] enabling usb keyboard and mouse support o usb/127248 usb [ucom] panic while uplcom devices attach and detach o usb/126884 usb [ugen] [patch] Bug in buffer handling in ugen.c o usb/126848 usb [usb]: USB Keyboard hangs during Installation o usb/126740 usb [ulpt] doesn't work on 7.0-RELEASE, 10 second stall be o usb/126519 usb [usb] [panic] panic when plugging in an iphone o kern/126396 usb [panic] kernel panic after unplug USB Bluetooth device o usb/125631 usb [ums] [panic] kernel panic during bootup while 'Logite o usb/125510 usb [panic] repeated plug and unplug of USB mass storage d o usb/125450 usb [panic] Removing USB flash card while being accessed c o usb/125088 usb [keyboard] Touchpad not detected on Adesso AKB-430UG U o usb/124980 usb [panic] kernel panic on detaching unmounted umass devi o kern/124777 usb [ucom] USB cua devices don't revert to tty devices whe o usb/124758 usb [rum] [panic] rum panics SMP kernel o usb/124708 usb [panic] Kernel panic on USB KVM reattach o kern/124130 usb [usb] gmirror fails to start usb devices that were pre o usb/123969 usb [usb] Supermicro H8SMi-2 usb problem: port reset faile o usb/123714 usb [usb] [panic] Panic when hald-storage-probe runs with o usb/123691 usb usbd(8): usbd hangs o usb/123690 usb [usb] [panic] Panic on USB device insertion when usb l o usb/123611 usb [usb] BBB reset failed, STALLED from Imation/Mitsumi U o usb/122992 usb [umass] [patch] MotoROKR Z6 Phone not recognised by um o usb/122936 usb [ucom] [ubsa] Device does not receive interrupt o usb/122905 usb [ubsa] [patch] add Huawei E220 to ubsa s usb/122819 usb [usb67] [patch] Patch to provide dynamic additions to o usb/122813 usb [udbp] [request] udbp driver should be removed in favo o usb/122547 usb [ehci] USB Printer not being recognized after reboot o usb/122539 usb [ohci] [panic] AnyDATA ADU-E1000D - kernel panic: ohci o usb/122483 usb [panic] [ulpt] Repeatable panic in 7.0-STABLE o usb/122119 usb [umass] umass device causes creation of daX but not da o usb/121755 usb [ohci] [patch] Fix panic after ohci/uhub cardbus devic o usb/121734 usb [ugen] ugen HP1022 printer device not working since up o usb/121708 usb [keyboard] nforce 650i mobo w/ usb keyboard infinite k o usb/121474 usb [cam] [patch] QUIRK: SAMSUNG HM250JI in LaCie usb hard o usb/121275 usb [boot] [panic] FreeBSD fails to boot with usb legacy s f usb/121232 usb [usb67] [panic] USB CardBus card removal causes reboot o usb/121169 usb [umass] Issues with usb mp3 player o usb/121045 usb [uftdi] [patch] Add support for PC-OP-RS1 and KURO-RS f usb/120786 usb [usb] [panic] Kernel panic when forced umount of a det o usb/120729 usb [panic] fault while in kernel mode with connecting USB o usb/120321 usb [hang] System hangs when transferring data to WD MyBoo o usb/120283 usb [panic] Automation reboot with wireless keyboard & mou o usb/120034 usb [hang] 6.2 & 6.3 hangs on boot at usb0: OHCI with 1.5 o usb/119977 usb [ums] Mouse does not work in a Cherry-USB keyboard/mou o usb/119653 usb [cam] [patch] iriver s7 player sync cache error patch o usb/119633 usb [umass] umass0: BBB reset failed, IOERROR [regression] o usb/119509 usb [usb] USB flaky on Dell Optiplex 755 o usb/119389 usb [umass] Sony DSC-W1 CBI reset failed, STALLED [regress o usb/119227 usb [ubsa] [patch] ubsa buffer is too small; should be tun o usb/119201 usb [cam] [patch] Quirks for Olympus FE-210 camera, LG and o usb/118480 usb [umass] Timeout in USB mass storage freezes vfs layer o usb/118353 usb [panic] [ppp] repeatable kernel panic during ppp(4) se o usb/118141 usb [ucom] usb serial and nokia phones ucomreadcb ucomread o usb/118140 usb [ucom] [patch] quick hack for ucom to get it behave wi o usb/118098 usb [umass] 6th gen iPod causes problems when disconnectin o usb/117955 usb [umass] [panic] inserting minolta dimage a2 crashes OS o usb/117946 usb [panic] D-Link DUB-E100 rev. B1 crashes FreeBSD 7.0-BE o usb/117938 usb [ums] [patch] Adding support for MS WL Natural and MS o usb/117911 usb [ums] [request] Mouse Gembird MUSWC not work o usb/117893 usb [umass] Lacie USB DVD writing failing o usb/117613 usb [uhci] [irq] uhci interrupt storm & USB leaked memory o usb/117598 usb [snd_uaudio] [patch] Not possible to record with Plant o usb/117313 usb [umass] [panic] panic on usb camera insertion o usb/117200 usb [ugen] ugen0 prints strange string on attach if detach o usb/117183 usb [panic] USB/fusefs -- panic while transferring large a p usb/116947 usb [ukbd] [patch] [regression] enable boot protocol on th o usb/116561 usb [umodem] [panic] RELENG_6 umodem panic "trying to slee o usb/116282 usb [ulpt] Cannot print on USB HP LJ1018 or LJ1300 o usb/115935 usb [usbdevs] [patch] kernel counterproductively attaches o usb/115933 usb [uftdi] [patch] RATOC REX-USB60F (usb serial converter o usb/115400 usb [ehci] Problem with EHCI on ASUS M2N4-SLI o usb/115298 usb [ulpt] [panic] Turning off USB printer panics kernel o usb/114916 usb [umass] [patch] USB Maxtor drive (L300RO) requires qui o kern/114780 usb [uplcom] [panic] Panics while stress testing the uplco o usb/114682 usb [umass] generic USB media-card reader unusable o usb/114310 usb [libusb] [patch] [panic] USB hub attachment panics ker o usb/114068 usb [usb67] [usb8] [umass] [patch] Problem with connection o conf/114013 usb [patch] WITHOUT_USB allow to compil a lot of USB stuff s usb/113060 usb [usb67] [ulpt] [patch] Samsung printer not working in o usb/110856 usb [usb67] [ugen] [patch] interrupt in msgs are truncated o usb/107827 usb [usb67] [ohci] [panic] ohci_add_done addr not found o usb/107388 usb [usb67] [usb8] [new driver] [patch] add utoppy device o usb/106041 usb [usb67] [usb8] [request] FreeBSD does not recognise Mu o usb/105361 usb [usb67] [panic] Kernel panic during unmounting mass st s usb/103917 usb [usb67] [uhub] USB driver reports "Addr 0 should never o usb/103418 usb [usb67] [usb8] [patch] [request] usbhidctl(8) add abil o usb/103046 usb [usb67] [ulpt] [patch] ulpt event driven I/O with sele o usb/101761 usb [usb67] [patch] [request] usb.h: increase maximal size o usb/100746 usb [usb67] [ukbd] system does not boot due to USB keyboar o usb/99431 usb [keyboard] FreeBSD on MSI 6566E (Intel 845E motherboar o kern/99200 usb [usb67] SMP-Kernel crashes reliably when Bluetooth con o usb/98343 usb [boot] BBB reset failed errors with Creative Muvo MP3 o usb/97472 usb [cam] [patch] add support for Olympus C150,D390 s usb/97286 usb [mouse] [request] MS Wireless Intellimouse Explorer 2. o usb/97175 usb [umass] [hang] USB cardreader hangs system o usb/96457 usb [umass] [panic] fatback on umass = reboot o usb/96381 usb [cam] [patch] add a quirk table entry for a flash ram o usb/96224 usb [usb] [msdosfs] mount_msdosfs cause page fault in sync s usb/96120 usb [ums] [request] USB mouse not always detected s usb/95636 usb [umass] [boot] 5 minute delay at boot when using VT620 o usb/95562 usb [umass] Write Stress in USB Mass drive causes "vinvalb f usb/95348 usb [keyboard] USB keyboard unplug causes noise on screen o usb/95037 usb [umass] USB disk not recognized on hot-plug. o usb/94897 usb [panic] Kernel Panic when cleanly unmounting USB disk o usb/94717 usb [ulpt] Reading from /dev/ulpt can break work of a UHCI o usb/94384 usb [panic] kernel panic with usb2 hardware o usb/93872 usb [cam] [patch] SCSI quirk required for ELTA 8061 OL USB o usb/93828 usb [ohci] [panic] ohci causes panic on boot (HP Pavillion o usb/93389 usb [umass] [patch] Digital Camera Pentax S60 don't work o usb/92852 usb [ums] [patch] Vertical scroll not working properly on o usb/92171 usb [panic] panic unplugging Vodafone Mobile Connect (UMTS o usb/92142 usb [uhub] SET_ADDR_FAILED and SHORT_XFER errors from usb o usb/92083 usb [ural] [panic] panic using WPA on ural NIC in 6.0-RELE o usb/92052 usb [ulpt] usbd causes defunct process with busy file-hand o usb/91906 usb [ehci] [hang] FreeBSD hangs while booting with USB leg f usb/91896 usb camcontrol(8): Serial Number of USB Memory Sticks is n o usb/91811 usb [umass] Compact Flash in HP Photosmart 2610 return " o usb/91546 usb [umodem] [patch] Nokia 6630 mobile phone does not work o usb/91538 usb [ulpt] [patch] Unable to print to EPSON CX3500 o usb/91283 usb [boot] [regression] booting very slow with usb devices o usb/91238 usb [umass] USB tape unit fails to write a second tape fil o usb/90700 usb [umass] [panic] Kernel panic on connect/mount/use umas o usb/89954 usb [umass] [panic] USB Disk driver race condition? s usb/89003 usb [request] LaCie Firewire drive not properly supported o usb/88743 usb [hang] [regression] USB makes kernel hang at boot (reg o usb/88408 usb [axe] axe0 read PHY failed o usb/87648 usb [mouse] Logitech USB-optical mouse problem. f usb/87224 usb [usb] Cannot mount USB Zip750 o usb/86767 usb [umass] [patch] bogus "slice starts beyond end of the o usb/86298 usb [mouse] Known good USB mouse won't work with correct s s usb/85067 usb [uscanner] Cannot attach ScanJet 4300C to usb device s usb/84336 usb [usb] [reboot] instant system reboot when unmounting a o usb/83977 usb [ucom] [panic] ucom1: open bulk out error (addr 2): IN o usb/83863 usb [ugen] Communication problem between opensc/openct via o usb/83756 usb [ums] [patch] Microsoft Intellimouse Explorer 4.0A doe o usb/83563 usb [umass] [panic] Page Fault while detaching Mpman Usb d o usb/83504 usb [kernel] [patch] SpeedTouch USB stop working on recent s usb/82569 usb [umass] [panic] USB mass storage plug/unplug causes sy o usb/82520 usb [udbp] [reboot] Reboot when USL101 connected o usb/82350 usb [ucom] [panic] null pointer dereference in USB stack o usb/81621 usb [ehci] [hang] external hd hangs under load on ehci o usb/80935 usb [uvisor] [patch] uvisor.c is not work with CLIE TH55. s usb/80777 usb [request] usb_rem_task() should wait for callback to c s usb/80776 usb [udav] [request] UDAV device driver shouldn't use usb_ o usb/80774 usb [patch] have "usbd_find_desc" in line with the other " o usb/80361 usb [umass] [patch] mounting of Dell usb-stick fails f usb/80040 usb [sound] [hang] Use of sound mixer causes system freeze o usb/79723 usb [usb] [request] prepare for high speed isochronous tra o usb/78984 usb [umass] [patch] Creative MUVO umass failure f usb/77294 usb [ucom] [panic] ucom + ulpcom panic o usb/76653 usb [umass] [patch] Problem with Asahi Optical usb device f usb/76395 usb [uhci] USB printer does not work, usbdevs says "addr 0 s usb/75928 usb [umass] [request] Cytronix SmartMedia card (SMC) reade o usb/75800 usb [ucom] ucom1: init failed STALLED error in time of syn o usb/75764 usb [umass] [patch] "umass0: Phase Error" - no device for f usb/75705 usb [umass] [panic] da0 attach / Optio S4 (with backtrace) f usb/74771 usb [umass] [hang] mounting write-protected umass device a s usb/74453 usb [umass] [patch] Q-lity CD-RW USB ECW-043 (ScanLogic SL o usb/74211 usb [umass] USB flash drive causes CAM status 0x4 on 4.10R o usb/73307 usb [panic] Kernel panics on USB disconnect o usb/71417 usb [ugen] Cryptoflex e-gate USB token (ugen0) communicati o usb/71416 usb [ugen] Cryptoflex e-gate USB token (ugen0) detach is n o usb/71280 usb [aue] aue0 device (linksys usb100tx) doesn't work in 1 o usb/71155 usb [ulpt] misbehaving usb-printer hangs processes, causes o usb/69006 usb [usbdevs] [patch] Apple Cinema Display hangs USB ports o usb/67301 usb [uftdi] [panic] RTS and system panic o usb/66547 usb [ucom] Palm Tungsten T USB does not initialize correct o usb/63621 usb [umass] [panic] USB MemoryStick Reader stalls/crashes s usb/62257 usb [umass] [request] card reader UCR-61S2B is only half-s s bin/57255 usb [patch] usbd(8) and multi-function devices s usb/52026 usb [usb] [request] umass driver support for InSystem ISD2 s usb/51958 usb [urio] [patch] update for urio driver o usb/40948 usb [umass] [request] USB HP CDW8200 does not work o usb/30929 usb [usb] [patch] use usbd to initialize USB ADSL modem 305 problems total. From owner-freebsd-usb@FreeBSD.ORG Mon Aug 29 12:16:21 2011 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 79195106566C for ; Mon, 29 Aug 2011 12:16:21 +0000 (UTC) (envelope-from mike@sentex.net) Received: from smarthost1.sentex.ca (smarthost1-6.sentex.ca [IPv6:2607:f3e0:0:1::12]) by mx1.freebsd.org (Postfix) with ESMTP id 2357A8FC15 for ; Mon, 29 Aug 2011 12:16:21 +0000 (UTC) Received: from [IPv6:2607:f3e0:0:4:f025:8813:7603:7e4a] (saphire3.sentex.ca [IPv6:2607:f3e0:0:4:f025:8813:7603:7e4a]) by smarthost1.sentex.ca (8.14.4/8.14.4) with ESMTP id p7TCGBHa051612; Mon, 29 Aug 2011 08:16:12 -0400 (EDT) (envelope-from mike@sentex.net) Message-ID: <4E5B82FF.2010506@sentex.net> Date: Mon, 29 Aug 2011 08:15:59 -0400 From: Mike Tancsa Organization: Sentex Communications User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7 MIME-Version: 1.0 To: Hans Petter Selasky References: <4E569BC1.2090307@sentex.net> <201108271404.50519.hselasky@c2i.net> <201108271500.45029.hselasky@c2i.net> In-Reply-To: <201108271500.45029.hselasky@c2i.net> X-Enigmail-Version: 1.1.1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.71 on IPv6:2607:f3e0:0:1::12 Cc: Marcin Wisnicki , freebsd-usb@freebsd.org Subject: Re: device reset X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Aug 2011 12:16:21 -0000 On 8/27/2011 9:00 AM, Hans Petter Selasky wrote: > On Saturday 27 August 2011 14:59:50 Marcin Wisnicki wrote: >> On Sat, Aug 27, 2011 at 14:04, Hans Petter Selasky wrote: >>> On Saturday 27 August 2011 13:19:35 Marcin Wisnicki wrote: >>>> Would it be possible to reinstate ability to power-cycle particular port >>>> the way it was ~year ago ? >>> >>> This is still possible. There is a sysctl to disable this feature: >>> >>> sysctl hw.usb.no_cs_fail=1 >> >> $ sysctl hw.usb.no_cs_fail >> sysctl: unknown oid 'hw.usb.no_cs_fail' >> $ uname -v >> FreeBSD 8.2-STABLE #4: Sun Jun 26 15:10:04 CEST 2011 >> root@ghost.pnet.one.pl:/home/obj/usr/src/sys/SERWER_DDB > > You need the kernel from the latest 8-stable. How do you power cycle just one port ? ---Mike -- ------------------- Mike Tancsa, tel +1 519 651 3400 Sentex Communications, mike@sentex.net Providing Internet services since 1994 www.sentex.net Cambridge, Ontario Canada http://www.tancsa.com/ From owner-freebsd-usb@FreeBSD.ORG Mon Aug 29 13:50:20 2011 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8139B1065676 for ; Mon, 29 Aug 2011 13:50:20 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe07.c2i.net [212.247.154.194]) by mx1.freebsd.org (Postfix) with ESMTP id F27858FC17 for ; Mon, 29 Aug 2011 13:50:19 +0000 (UTC) X-Cloudmark-Score: 0.000000 [] X-Cloudmark-Analysis: v=1.1 cv=We2KpSpXIp7zua8olfHtbA6oPL2p8ijoExYxXUNIRvU= c=1 sm=1 a=SvYTsOw2Z4kA:10 a=WQU8e4WWZSUA:10 a=IkcTkHD0fZMA:10 a=CL8lFSKtTFcA:10 a=i9M/sDlu2rpZ9XS819oYzg==:17 a=8kQB0OdkAAAA:8 a=PfrXpk_LKmLQdFhpnQcA:9 a=F6nJ6xXE--yO90CykSsA:7 a=QEXdDO2ut3YA:10 a=9aOQ2cSd83gA:10 a=i9M/sDlu2rpZ9XS819oYzg==:117 Received: from [188.126.198.129] (account mc467741@c2i.net HELO laptop002.hselasky.homeunix.org) by mailfe07.swip.net (CommuniGate Pro SMTP 5.2.19) with ESMTPA id 172108393; Mon, 29 Aug 2011 15:50:16 +0200 From: Hans Petter Selasky To: Mike Tancsa Date: Mon, 29 Aug 2011 15:47:43 +0200 User-Agent: KMail/1.13.5 (FreeBSD/8.2-STABLE; KDE/4.4.5; amd64; ; ) References: <4E569BC1.2090307@sentex.net> <201108271500.45029.hselasky@c2i.net> <4E5B82FF.2010506@sentex.net> In-Reply-To: <4E5B82FF.2010506@sentex.net> X-Face: *nPdTl_}RuAI6^PVpA02T?$%Xa^>@hE0uyUIoiha$pC:9TVgl.Oq, NwSZ4V"|LR.+tj}g5 %V,x^qOs~mnU3]Gn; cQLv&.N>TrxmSFf+p6(30a/{)KUU!s}w\IhQBj}[g}bj0I3^glmC( :AuzV9:.hESm-x4h240C`9=w MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201108291547.43544.hselasky@c2i.net> Cc: Marcin Wisnicki , freebsd-usb@freebsd.org Subject: Re: device reset X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Aug 2011 13:50:20 -0000 On Monday 29 August 2011 14:15:59 Mike Tancsa wrote: > On 8/27/2011 9:00 AM, Hans Petter Selasky wrote: > > On Saturday 27 August 2011 14:59:50 Marcin Wisnicki wrote: > >> On Sat, Aug 27, 2011 at 14:04, Hans Petter Selasky wrote: > >>> On Saturday 27 August 2011 13:19:35 Marcin Wisnicki wrote: > >>>> Would it be possible to reinstate ability to power-cycle particular > >>>> port the way it was ~year ago ? > >>> > >>> This is still possible. There is a sysctl to disable this feature: > >>> > >>> sysctl hw.usb.no_cs_fail=1 > >> > >> $ sysctl hw.usb.no_cs_fail > >> sysctl: unknown oid 'hw.usb.no_cs_fail' > >> $ uname -v > >> FreeBSD 8.2-STABLE #4: Sun Jun 26 15:10:04 CEST 2011 > >> root@ghost.pnet.one.pl:/home/obj/usr/src/sys/SERWER_DDB > > > > You need the kernel from the latest 8-stable. > > How do you power cycle just one port ? > > ---Mike You need to send a custom control request. --HPS From owner-freebsd-usb@FreeBSD.ORG Mon Aug 29 18:06:51 2011 Return-Path: Delivered-To: usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1326F1065670 for ; Mon, 29 Aug 2011 18:06:51 +0000 (UTC) (envelope-from egrosbein@rdtc.ru) Received: from eg.sd.rdtc.ru (unknown [IPv6:2a03:3100:c:13::5]) by mx1.freebsd.org (Postfix) with ESMTP id 7578F8FC0C for ; Mon, 29 Aug 2011 18:06:50 +0000 (UTC) Received: from eg.sd.rdtc.ru (localhost [127.0.0.1]) by eg.sd.rdtc.ru (8.14.5/8.14.5) with ESMTP id p7TI6mFK029599 for ; Tue, 30 Aug 2011 01:06:49 +0700 (NOVST) (envelope-from egrosbein@rdtc.ru) Message-ID: <4E5BD533.6010208@rdtc.ru> Date: Tue, 30 Aug 2011 01:06:43 +0700 From: Eugene Grosbein User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; ru-RU; rv:1.9.2.13) Gecko/20110112 Thunderbird/3.1.7 MIME-Version: 1.0 To: usb@freebsd.org Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: Subject: power off port physically X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Aug 2011 18:06:51 -0000 Hi! How do I power USB port off with FreeBSD 8.2-STABLE? I have USB 3G modem with LED and all my attempts to power it off with usbconfig power_off/power_on, set_state 255 to its hub do nothing to modem's LED that is ON still, so modem does not get powered off physically. I have Intel D975XBX motherboard and use its onboard USB2.0 ports: # usbconfig ugen0.1: at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=SAVE ugen1.1: at usbus1, cfg=0 md=HOST spd=FULL (12Mbps) pwr=SAVE ugen2.1: at usbus2, cfg=0 md=HOST spd=FULL (12Mbps) pwr=SAVE ugen3.1: at usbus3, cfg=0 md=HOST spd=FULL (12Mbps) pwr=SAVE ugen4.1: at usbus4, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE ugen0.2: at usbus0, cfg=0 md=HOST spd=LOW (1.5Mbps) pwr=ON ugen4.2: at usbus4, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE ugen4.3: at usbus4, cfg=255 md=HOST spd=HIGH (480Mbps) pwr=ON As you can see, I also have additional USB Hub intergrated with my monitor, tried its ports too - without luck. Please CC: me as I'm not in the list. Eugene Grosbein From owner-freebsd-usb@FreeBSD.ORG Mon Aug 29 18:12:45 2011 Return-Path: Delivered-To: usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 37DEA1065670 for ; Mon, 29 Aug 2011 18:12:45 +0000 (UTC) (envelope-from mike@sentex.net) Received: from smarthost1.sentex.ca (smarthost1-6.sentex.ca [IPv6:2607:f3e0:0:1::12]) by mx1.freebsd.org (Postfix) with ESMTP id F1E8C8FC16 for ; Mon, 29 Aug 2011 18:12:44 +0000 (UTC) Received: from [IPv6:2607:f3e0:0:4:f025:8813:7603:7e4a] (saphire3.sentex.ca [IPv6:2607:f3e0:0:4:f025:8813:7603:7e4a]) by smarthost1.sentex.ca (8.14.4/8.14.4) with ESMTP id p7TICgUQ017125; Mon, 29 Aug 2011 14:12:42 -0400 (EDT) (envelope-from mike@sentex.net) Message-ID: <4E5BD68D.7040008@sentex.net> Date: Mon, 29 Aug 2011 14:12:29 -0400 From: Mike Tancsa Organization: Sentex Communications User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7 MIME-Version: 1.0 To: Eugene Grosbein References: <4E5BD533.6010208@rdtc.ru> In-Reply-To: <4E5BD533.6010208@rdtc.ru> X-Enigmail-Version: 1.1.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.71 on IPv6:2607:f3e0:0:1::12 Cc: usb@freebsd.org Subject: Re: power off port physically X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Aug 2011 18:12:45 -0000 On 8/29/2011 2:06 PM, Eugene Grosbein wrote: > Hi! > > How do I power USB port off with FreeBSD 8.2-STABLE? > > I have USB 3G modem with LED and all my attempts to power it off > with usbconfig power_off/power_on, set_state 255 to its hub do nothing > to modem's LED that is ON still, so modem does not get powered off physically. See the thread http://lists.freebsd.org/pipermail/freebsd-usb/2011-August/010590.html It was just discussed a few days ago :) There have been other threads as well. It seems some manufacturers hardwire the ports, so you cannot shut power to the device. However, I have found a dlink hub that works as expected. ---Mike -- ------------------- Mike Tancsa, tel +1 519 651 3400 Sentex Communications, mike@sentex.net Providing Internet services since 1994 www.sentex.net Cambridge, Ontario Canada http://www.tancsa.com/ From owner-freebsd-usb@FreeBSD.ORG Mon Aug 29 18:13:37 2011 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C5417106566B for ; Mon, 29 Aug 2011 18:13:37 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe08.c2i.net [212.247.154.226]) by mx1.freebsd.org (Postfix) with ESMTP id 3E9748FC13 for ; Mon, 29 Aug 2011 18:13:37 +0000 (UTC) X-Cloudmark-Score: 0.000000 [] X-Cloudmark-Analysis: v=1.1 cv=ZrWDMTID0AMW4DNRKF44fvigJaUxxg2ESvddpUoMqyA= c=1 sm=1 a=SvYTsOw2Z4kA:10 a=WQU8e4WWZSUA:10 a=8nJEP1OIZ-IA:10 a=CL8lFSKtTFcA:10 a=i9M/sDlu2rpZ9XS819oYzg==:17 a=UF61Oved4NnZ0Ygp0ksA:9 a=wPNLvfGTeEIA:10 a=i9M/sDlu2rpZ9XS819oYzg==:117 Received: from [188.126.198.129] (account mc467741@c2i.net HELO laptop002.hselasky.homeunix.org) by mailfe08.swip.net (CommuniGate Pro SMTP 5.2.19) with ESMTPA id 172581293; Mon, 29 Aug 2011 20:13:35 +0200 From: Hans Petter Selasky To: freebsd-usb@freebsd.org Date: Mon, 29 Aug 2011 20:11:00 +0200 User-Agent: KMail/1.13.5 (FreeBSD/8.2-STABLE; KDE/4.4.5; amd64; ; ) References: <4E5BD533.6010208@rdtc.ru> In-Reply-To: <4E5BD533.6010208@rdtc.ru> X-Face: *nPdTl_}RuAI6^PVpA02T?$%Xa^>@hE0uyUIoiha$pC:9TVgl.Oq, NwSZ4V"|LR.+tj}g5 %V,x^qOs~mnU3]Gn; cQLv&.N>TrxmSFf+p6(30a/{)KUU!s}w\IhQBj}[g}bj0I3^glmC( :AuzV9:.hESm-x4h240C`9=w MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201108292011.00706.hselasky@c2i.net> Cc: Eugene Grosbein Subject: Re: power off port physically X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Aug 2011 18:13:37 -0000 On Monday 29 August 2011 20:06:43 Eugene Grosbein wrote: > Hi! > Hi, > How do I power USB port off with FreeBSD 8.2-STABLE? If you use an external HUB and the HUB does not have the power always one, like some do, it should be enough to re-enumerate the parent HUB which your device is connected to. --HPS > > I have USB 3G modem with LED and all my attempts to power it off > with usbconfig power_off/power_on, set_state 255 to its hub do nothing > to modem's LED that is ON still, so modem does not get powered off > physically. > > I have Intel D975XBX motherboard and use its onboard USB2.0 ports: > > # usbconfig > ugen0.1: at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) > pwr=SAVE ugen1.1: at usbus1, cfg=0 md=HOST spd=FULL > (12Mbps) pwr=SAVE ugen2.1: at usbus2, cfg=0 md=HOST > spd=FULL (12Mbps) pwr=SAVE ugen3.1: at usbus3, cfg=0 > md=HOST spd=FULL (12Mbps) pwr=SAVE ugen4.1: at > usbus4, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE ugen0.2: FW651.18.I USB FW7.4 American Power Conversion> at usbus0, cfg=0 md=HOST > spd=LOW (1.5Mbps) pwr=ON ugen4.2: at usbus4, > cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE ugen4.3: MSM ZTE, Incorporated> at usbus4, cfg=255 md=HOST spd=HIGH (480Mbps) > pwr=ON > > As you can see, I also have additional USB Hub intergrated with my monitor, > tried its ports too - without luck. > > Please CC: me as I'm not in the list. From owner-freebsd-usb@FreeBSD.ORG Mon Aug 29 18:18:43 2011 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6F6C61065670 for ; Mon, 29 Aug 2011 18:18:43 +0000 (UTC) (envelope-from egrosbein@rdtc.ru) Received: from eg.sd.rdtc.ru (unknown [IPv6:2a03:3100:c:13::5]) by mx1.freebsd.org (Postfix) with ESMTP id B7C3B8FC16 for ; Mon, 29 Aug 2011 18:18:42 +0000 (UTC) Received: from eg.sd.rdtc.ru (localhost [127.0.0.1]) by eg.sd.rdtc.ru (8.14.5/8.14.5) with ESMTP id p7TIIY4J029654; Tue, 30 Aug 2011 01:18:34 +0700 (NOVST) (envelope-from egrosbein@rdtc.ru) Message-ID: <4E5BD7F5.1010700@rdtc.ru> Date: Tue, 30 Aug 2011 01:18:29 +0700 From: Eugene Grosbein User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; ru-RU; rv:1.9.2.13) Gecko/20110112 Thunderbird/3.1.7 MIME-Version: 1.0 To: Hans Petter Selasky References: <4E5BD533.6010208@rdtc.ru> <201108292011.00706.hselasky@c2i.net> In-Reply-To: <201108292011.00706.hselasky@c2i.net> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: freebsd-usb@freebsd.org Subject: Re: power off port physically X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Aug 2011 18:18:43 -0000 30.08.2011 01:11, Hans Petter Selasky wrote: >> I have USB 3G modem with LED and all my attempts to power it off >> with usbconfig power_off/power_on, set_state 255 to its hub do nothing >> to modem's LED that is ON still, so modem does not get powered off >> physically. >> >> I have Intel D975XBX motherboard and use its onboard USB2.0 ports: >> >> # usbconfig >> ugen0.1: at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) >> pwr=SAVE ugen1.1: at usbus1, cfg=0 md=HOST spd=FULL >> (12Mbps) pwr=SAVE ugen2.1: at usbus2, cfg=0 md=HOST >> spd=FULL (12Mbps) pwr=SAVE ugen3.1: at usbus3, cfg=0 >> md=HOST spd=FULL (12Mbps) pwr=SAVE ugen4.1: at >> usbus4, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE ugen0.2: > FW651.18.I USB FW7.4 American Power Conversion> at usbus0, cfg=0 md=HOST >> spd=LOW (1.5Mbps) pwr=ON ugen4.2: at usbus4, >> cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE ugen4.3: > MSM ZTE, Incorporated> at usbus4, cfg=255 md=HOST spd=HIGH (480Mbps) >> pwr=ON >> >> As you can see, I also have additional USB Hub intergrated with my monitor, >> tried its ports too - without luck. >> >> Please CC: me as I'm not in the list. >> How do I power USB port off with FreeBSD 8.2-STABLE? > > If you use an external HUB and the HUB does not have the power always one, > like some do, it should be enough to re-enumerate the parent HUB which your > device is connected to. I use motherboard-integrated USB ports. How do I "re-enumerate" the parent HUB? I've tried "usbconfig -d 4.1 set_config 255" - it does not power my device off. I need not quick reset. I need power it off for long time. Eugene Grosbein From owner-freebsd-usb@FreeBSD.ORG Mon Aug 29 18:36:47 2011 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9ADAE106564A for ; Mon, 29 Aug 2011 18:36:47 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe08.c2i.net [212.247.154.226]) by mx1.freebsd.org (Postfix) with ESMTP id 191448FC13 for ; Mon, 29 Aug 2011 18:36:46 +0000 (UTC) X-Cloudmark-Score: 0.000000 [] X-Cloudmark-Analysis: v=1.1 cv=ZrWDMTID0AMW4DNRKF44fvigJaUxxg2ESvddpUoMqyA= c=1 sm=1 a=SvYTsOw2Z4kA:10 a=WQU8e4WWZSUA:10 a=8nJEP1OIZ-IA:10 a=CL8lFSKtTFcA:10 a=i9M/sDlu2rpZ9XS819oYzg==:17 a=2kYNRXJinEix5IcCPUcA:9 a=wPNLvfGTeEIA:10 a=i9M/sDlu2rpZ9XS819oYzg==:117 Received: from [188.126.198.129] (account mc467741@c2i.net HELO laptop002.hselasky.homeunix.org) by mailfe08.swip.net (CommuniGate Pro SMTP 5.2.19) with ESMTPA id 172589123; Mon, 29 Aug 2011 20:36:45 +0200 From: Hans Petter Selasky To: Eugene Grosbein Date: Mon, 29 Aug 2011 20:34:11 +0200 User-Agent: KMail/1.13.5 (FreeBSD/8.2-STABLE; KDE/4.4.5; amd64; ; ) References: <4E5BD533.6010208@rdtc.ru> <201108292011.00706.hselasky@c2i.net> <4E5BD7F5.1010700@rdtc.ru> In-Reply-To: <4E5BD7F5.1010700@rdtc.ru> X-Face: *nPdTl_}RuAI6^PVpA02T?$%Xa^>@hE0uyUIoiha$pC:9TVgl.Oq, NwSZ4V"|LR.+tj}g5 %V,x^qOs~mnU3]Gn; cQLv&.N>TrxmSFf+p6(30a/{)KUU!s}w\IhQBj}[g}bj0I3^glmC( :AuzV9:.hESm-x4h240C`9=w MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201108292034.11298.hselasky@c2i.net> Cc: freebsd-usb@freebsd.org Subject: Re: power off port physically X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Aug 2011 18:36:47 -0000 On Monday 29 August 2011 20:18:29 Eugene Grosbein wrote: > 30.08.2011 01:11, Hans Petter Selasky wrote: > >> I have USB 3G modem with LED and all my attempts to power it off > >> with usbconfig power_off/power_on, set_state 255 to its hub do nothing > >> to modem's LED that is ON still, so modem does not get powered off > >> physically. > >> > >> I have Intel D975XBX motherboard and use its onboard USB2.0 ports: > >> > >> # usbconfig > >> ugen0.1: at usbus0, cfg=0 md=HOST spd=FULL > >> (12Mbps) pwr=SAVE ugen1.1: at usbus1, cfg=0 > >> md=HOST spd=FULL (12Mbps) pwr=SAVE ugen2.1: at > >> usbus2, cfg=0 md=HOST spd=FULL (12Mbps) pwr=SAVE ugen3.1: >> HUB Intel> at usbus3, cfg=0 md=HOST spd=FULL (12Mbps) pwr=SAVE ugen4.1: > >> at usbus4, cfg=0 md=HOST spd=HIGH (480Mbps) > >> pwr=SAVE ugen0.2: >> Conversion> at usbus0, cfg=0 md=HOST spd=LOW (1.5Mbps) pwr=ON ugen4.2: > >> at usbus4, cfg=0 md=HOST spd=HIGH (480Mbps) > >> pwr=SAVE ugen4.3: at > >> usbus4, cfg=255 md=HOST spd=HIGH (480Mbps) pwr=ON > >> > >> As you can see, I also have additional USB Hub intergrated with my > >> monitor, tried its ports too - without luck. > >> > >> Please CC: me as I'm not in the list. > >> > >> How do I power USB port off with FreeBSD 8.2-STABLE? > > > > If you use an external HUB and the HUB does not have the power always > > one, like some do, it should be enough to re-enumerate the parent HUB > > which your device is connected to. > > I use motherboard-integrated USB ports. How do I "re-enumerate" the parent > HUB? I've tried "usbconfig -d 4.1 set_config 255" - it does not power my > device off. > > I need not quick reset. I need power it off for long time. Hi, You could try: usbconfig -d X.Y suspend or usbconfig -d X.Y power_off, though if the hardware is not constructed to support power off it won't work. Also read the thread that Mike referred to. --HPS From owner-freebsd-usb@FreeBSD.ORG Mon Aug 29 21:10:09 2011 Return-Path: Delivered-To: freebsd-usb@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 789B21065670 for ; Mon, 29 Aug 2011 21:10:09 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 56C4A8FC17 for ; Mon, 29 Aug 2011 21:10:09 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p7TLA9Z8044323 for ; Mon, 29 Aug 2011 21:10:09 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p7TLA9Cj044322; Mon, 29 Aug 2011 21:10:09 GMT (envelope-from gnats) Resent-Date: Mon, 29 Aug 2011 21:10:09 GMT Resent-Message-Id: <201108292110.p7TLA9Cj044322@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-usb@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Brett Glass Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 06E261065672 for ; Mon, 29 Aug 2011 21:05:31 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id EB3E98FC0A for ; Mon, 29 Aug 2011 21:05:30 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.4/8.14.4) with ESMTP id p7TL5U8A049308 for ; Mon, 29 Aug 2011 21:05:30 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.4/8.14.4/Submit) id p7TL5Un1049306; Mon, 29 Aug 2011 21:05:30 GMT (envelope-from nobody) Message-Id: <201108292105.p7TL5Un1049306@red.freebsd.org> Date: Mon, 29 Aug 2011 21:05:30 GMT From: Brett Glass To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: usb/160299: MicroSDHC-to-USB adapters do not work in FreeBSD 8.x X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Aug 2011 21:10:09 -0000 >Number: 160299 >Category: usb >Synopsis: MicroSDHC-to-USB adapters do not work in FreeBSD 8.x >Confidential: no >Severity: serious >Priority: high >Responsible: freebsd-usb >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Aug 29 21:10:08 UTC 2011 >Closed-Date: >Last-Modified: >Originator: Brett Glass >Release: FreeBSD 8.1-RELEASE >Organization: LARIAT >Environment: >Description: I have tried MicroSDHC cards from several different vendors (Kingston, Sandisk, etc.), with different MicroSDHC-to-USB adapters (also Kingston and Sandisk), in FreeBSD 8.x systems. All cause SCSI errors such as (da1:umass-sim1:1:0:0): SYNCHRONIZE CACHE(10). CDB: 35 0 0 0 0 0 0 0 0 0 (da1:umass-sim1:1:0:0): SCSI sense: Error code 0x52 Some USB flash memory sticks also produce similar errors. In all cases the system sometimes hangs in the driver and the memory card or stick gets quite warm, as if the system is trying the failed operation again and again. It appears that the problem, which has existed since FreeBSD 4.x, is that the system expects to be able to issue SCSI commands to flash drives (which are not SCSI drives). As a search of recent PRs reveals, this problem has been addressed as a "quirk" on a per-device basis for many individual devices (including memory sticks and cell phones that emulate them), but keeps recurring as new ones are released. A more general fix is needed. >How-To-Repeat: Place a MicroSDHC card in a USB adapter and insert in a FreeBSD 8.x machine. Try to read and write it. >Fix: This behavior is so common that it should not be characterized as a quirk but as a general property of USB flash devices. All USB flash storage devices should have SYNCHRONIZE CACHE and similar SCSI commands disabled by default. These commands should, of course, be enabled for USB-attached ATAPI rotating media, which supports them. >Release-Note: >Audit-Trail: >Unformatted: From owner-freebsd-usb@FreeBSD.ORG Mon Aug 29 23:20:05 2011 Return-Path: Delivered-To: freebsd-usb@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 49E351065670 for ; Mon, 29 Aug 2011 23:20:05 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 21B3B8FC1B for ; Mon, 29 Aug 2011 23:20:05 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p7TNK465065453 for ; Mon, 29 Aug 2011 23:20:05 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p7TNK4WS065452; Mon, 29 Aug 2011 23:20:04 GMT (envelope-from gnats) Resent-Date: Mon, 29 Aug 2011 23:20:04 GMT Resent-Message-Id: <201108292320.p7TNK4WS065452@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-usb@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Garrett Cooper Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CB9381065673 for ; Mon, 29 Aug 2011 23:16:52 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id BB3F78FC08 for ; Mon, 29 Aug 2011 23:16:52 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.4/8.14.4) with ESMTP id p7TNGqWt078307 for ; Mon, 29 Aug 2011 23:16:52 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.4/8.14.4/Submit) id p7TNGqXc078296; Mon, 29 Aug 2011 23:16:52 GMT (envelope-from nobody) Message-Id: <201108292316.p7TNGqXc078296@red.freebsd.org> Date: Mon, 29 Aug 2011 23:16:52 GMT From: Garrett Cooper To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: usb/160301: [patch] missing device usb and device ucom entries in manpages X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Aug 2011 23:20:05 -0000 >Number: 160301 >Category: usb >Synopsis: [patch] missing device usb and device ucom entries in manpages >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-usb >State: open >Quarter: >Keywords: >Date-Required: >Class: doc-bug >Submitter-Id: current-users >Arrival-Date: Mon Aug 29 23:20:04 UTC 2011 >Closed-Date: >Last-Modified: >Originator: Garrett Cooper >Release: 9.0-BETA1 >Organization: iXsystems, Inc. >Environment: FreeBSD burnout.ixsystems.com 9.0-BETA1 FreeBSD 9.0-BETA1 #0 r224989: Sun Aug 21 14:12:11 PDT 2011 gcooper@burnout.ixsystems.com:/usr/obj/usr/src/sys/BURNOUT amd64 >Description: The USB serial modules manpages are missing dependencies on usb and ucom: $ svngrep -r DEPEND /sys/dev/usb/serial/ | sed -E -e 's/.*MODULE_DEPEND\(//g' -e 's/(usb|ucom),.*/\1/g' -e 's/,/->/' | grep -v ^ucom | sort u3g-> ucom u3g-> usb uark-> ucom uark-> usb ubsa-> ucom ubsa-> usb ubser-> ucom ubser-> usb uchcom-> ucom uchcom-> usb ucycom-> ucom ucycom-> usb ufoma-> ucom ufoma-> usb uftdi-> ucom uftdi-> usb ugensa-> ucom ugensa-> usb uipaq-> ucom uipaq-> usb ulpt-> usb umcs7840-> ucom umcs7840-> usb umct-> ucom umct-> usb umodem-> ucom umodem-> usb umoscom-> ucom umoscom-> usb uplcom-> ucom uplcom-> usb uslcom-> ucom uslcom-> usb uvisor-> ucom uvisor-> usb uvscom-> ucom uvscom-> usb The attached patch fixes the manpage bugs. >How-To-Repeat: >Fix: Patch attached with submission follows: Index: share/man/man4/ufoma.4 =================================================================== --- share/man/man4/ufoma.4 (revision 224989) +++ share/man/man4/ufoma.4 (working copy) @@ -38,6 +38,8 @@ place the following lines in your kernel configuration file: .Bd -ragged -offset indent +.Cd "device usb" +.Cd "device ucom" .Cd "device ufoma" .Ed .Pp Index: share/man/man4/uchcom.4 =================================================================== --- share/man/man4/uchcom.4 (revision 224989) +++ share/man/man4/uchcom.4 (working copy) @@ -40,6 +40,8 @@ place the following lines in your kernel configuration file: .Bd -ragged -offset indent +.Cd "device usb" +.Cd "device ucom" .Cd "device uchcom" .Ed .Pp Index: share/man/man4/uvisor.4 =================================================================== --- share/man/man4/uvisor.4 (revision 224989) +++ share/man/man4/uvisor.4 (working copy) @@ -40,6 +40,8 @@ place the following lines in your kernel configuration file: .Bd -ragged -offset indent +.Cd "device usb" +.Cd "device ucom" .Cd "device uvisor" .Ed .Pp Index: share/man/man4/uplcom.4 =================================================================== --- share/man/man4/uplcom.4 (revision 224989) +++ share/man/man4/uplcom.4 (working copy) @@ -40,6 +40,8 @@ place the following lines in your kernel configuration file: .Bd -ragged -offset indent +.Cd "device usb" +.Cd "device ucom" .Cd "device uplcom" .Ed .Pp Index: share/man/man4/ubser.4 =================================================================== --- share/man/man4/ubser.4 (revision 224989) +++ share/man/man4/ubser.4 (working copy) @@ -39,6 +39,8 @@ place the following line in your kernel configuration file: .Bd -ragged -offset indent +.Cd "device usb" +.Cd "device ucom" .Cd "device ubser" .Ed .Pp Index: share/man/man4/umodem.4 =================================================================== --- share/man/man4/umodem.4 (revision 224989) +++ share/man/man4/umodem.4 (working copy) @@ -40,6 +40,8 @@ place the following lines in your kernel configuration file: .Bd -ragged -offset indent +.Cd "device usb" +.Cd "device ucom" .Cd "device umodem" .Ed .Pp Index: share/man/man4/ubsa.4 =================================================================== --- share/man/man4/ubsa.4 (revision 224989) +++ share/man/man4/ubsa.4 (working copy) @@ -39,6 +39,8 @@ place the following lines in your kernel configuration file: .Bd -ragged -offset indent +.Cd "device usb" +.Cd "device ucom" .Cd "device ubsa" .Ed .Pp Index: share/man/man4/umcs.4 =================================================================== --- share/man/man4/umcs.4 (revision 224989) +++ share/man/man4/umcs.4 (working copy) @@ -39,6 +39,8 @@ place the following lines in your kernel configuration file: .Bd -ragged -offset indent +.Cd "device usb" +.Cd "device ucom" .Cd "device umcs" .Ed .Pp Index: share/man/man4/uftdi.4 =================================================================== --- share/man/man4/uftdi.4 (revision 224989) +++ share/man/man4/uftdi.4 (working copy) @@ -40,6 +40,8 @@ place the following lines in your kernel configuration file: .Bd -ragged -offset indent +.Cd "device usb" +.Cd "device ucom" .Cd "device uftdi" .Ed .Pp Index: share/man/man4/umct.4 =================================================================== --- share/man/man4/umct.4 (revision 224989) +++ share/man/man4/umct.4 (working copy) @@ -36,6 +36,8 @@ place the following lines in your kernel configuration file: .Bd -ragged -offset indent +.Cd "device usb" +.Cd "device ucom" .Cd "device umct" .Ed .Pp Index: share/man/man4/uvscom.4 =================================================================== --- share/man/man4/uvscom.4 (revision 224989) +++ share/man/man4/uvscom.4 (working copy) @@ -40,6 +40,8 @@ place the following lines in your kernel configuration file: .Bd -ragged -offset indent +.Cd "device usb" +.Cd "device ucom" .Cd "device uvscom" .Ed .Pp Index: share/man/man4/uipaq.4 =================================================================== --- share/man/man4/uipaq.4 (revision 224989) +++ share/man/man4/uipaq.4 (working copy) @@ -41,6 +41,8 @@ place the following lines in your kernel configuration file: .Bd -ragged -offset indent +.Cd "device usb" +.Cd "device ucom" .Cd "device uipaq" .Ed .Pp Index: share/man/man4/u3g.4 =================================================================== --- share/man/man4/u3g.4 (revision 224989) +++ share/man/man4/u3g.4 (working copy) @@ -29,6 +29,8 @@ place the following lines in your kernel configuration file: .Bd -ragged -offset indent +.Cd "device usb" +.Cd "device ucom" .Cd "device u3g" .Ed .Pp Index: share/man/man4/uark.4 =================================================================== --- share/man/man4/uark.4 (revision 224989) +++ share/man/man4/uark.4 (working copy) @@ -27,6 +27,8 @@ place the following lines in your kernel configuration file: .Bd -ragged -offset indent +.Cd "device usb" +.Cd "device ucom" .Cd "device uark" .Ed .Pp Index: share/man/man4/uslcom.4 =================================================================== --- share/man/man4/uslcom.4 (revision 224989) +++ share/man/man4/uslcom.4 (working copy) @@ -27,6 +27,8 @@ place the following lines in your kernel configuration file: .Bd -ragged -offset indent +.Cd "device usb" +.Cd "device ucom" .Cd "device uslcom" .Ed .Pp Index: share/man/man4/ucycom.4 =================================================================== --- share/man/man4/ucycom.4 (revision 224989) +++ share/man/man4/ucycom.4 (working copy) @@ -38,6 +38,8 @@ place the following line in your kernel configuration file: .Bd -ragged -offset indent +.Cd "device usb" +.Cd "device ucom" .Cd "device ucycom" .Ed .Pp >Release-Note: >Audit-Trail: >Unformatted: From owner-freebsd-usb@FreeBSD.ORG Tue Aug 30 01:56:24 2011 Return-Path: Delivered-To: freebsd-usb@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B15471065674; Tue, 30 Aug 2011 01:56:24 +0000 (UTC) (envelope-from linimon@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 899618FC19; Tue, 30 Aug 2011 01:56:24 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p7U1uObf015808; Tue, 30 Aug 2011 01:56:24 GMT (envelope-from linimon@freefall.freebsd.org) Received: (from linimon@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p7U1uOut015804; Tue, 30 Aug 2011 01:56:24 GMT (envelope-from linimon) Date: Tue, 30 Aug 2011 01:56:24 GMT Message-Id: <201108300156.p7U1uOut015804@freefall.freebsd.org> To: linimon@FreeBSD.org, freebsd-bugs@FreeBSD.org, freebsd-usb@FreeBSD.org From: linimon@FreeBSD.org Cc: Subject: Re: usb/160192: [install] Installation from USB-Stick doesn't find the USB-Stick X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Aug 2011 01:56:24 -0000 Old Synopsis: Installation from USB-Stick doesn't find the USB-Stick New Synopsis: [install] Installation from USB-Stick doesn't find the USB-Stick Responsible-Changed-From-To: freebsd-bugs->freebsd-usb Responsible-Changed-By: linimon Responsible-Changed-When: Tue Aug 30 01:54:16 UTC 2011 Responsible-Changed-Why: reclassify. http://www.freebsd.org/cgi/query-pr.cgi?pr=160192 From owner-freebsd-usb@FreeBSD.ORG Tue Aug 30 09:02:30 2011 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E7706106566B; Tue, 30 Aug 2011 09:02:30 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe05.c2i.net [212.247.154.130]) by mx1.freebsd.org (Postfix) with ESMTP id D0E458FC14; Tue, 30 Aug 2011 09:02:29 +0000 (UTC) X-Cloudmark-Score: 0.000000 [] X-Cloudmark-Analysis: v=1.1 cv=npWEf5XEtLL8qLh8yAfHNcIa2ktE1/5Qf1/k+5E0ZhU= c=1 sm=1 a=SvYTsOw2Z4kA:10 a=Y-1o0aH3NeIA:10 a=WQU8e4WWZSUA:10 a=CL8lFSKtTFcA:10 a=i9M/sDlu2rpZ9XS819oYzg==:17 a=ZGVnZpYUjxizuV_3c3UA:9 a=13A5fur-bAXGqlbjPb8A:7 a=PUjeQqilurYA:10 a=0MY3xBBhyjFr597GSXYA:9 a=mAxi7OycM_saGv83rl8A:7 a=ehyuEvSailH4wevd:21 a=6NdhkCFPBIbN1JFK:21 a=i9M/sDlu2rpZ9XS819oYzg==:117 Received: from [188.126.198.129] (account mc467741@c2i.net HELO laptop002.hselasky.homeunix.org) by mailfe05.swip.net (CommuniGate Pro SMTP 5.2.19) with ESMTPA id 170582776; Tue, 30 Aug 2011 11:02:26 +0200 From: Hans Petter Selasky To: freebsd-usb@freebsd.org Date: Tue, 30 Aug 2011 10:59:52 +0200 User-Agent: KMail/1.13.5 (FreeBSD/8.2-STABLE; KDE/4.4.5; amd64; ; ) References: <201108292105.p7TL5Un1049306@red.freebsd.org> In-Reply-To: <201108292105.p7TL5Un1049306@red.freebsd.org> X-Face: *nPdTl_}RuAI6^PVpA02T?$%Xa^>@hE0uyUIoiha$pC:9TVgl.Oq, NwSZ4V"|LR.+tj}g5 %V,x^qOs~mnU3]Gn; cQLv&.N>TrxmSFf+p6(30a/{)KUU!s}w\IhQBj}[g}bj0I3^glmC( :AuzV9:.hESm-x4h240C`9=w MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_IaKXO97fubXM8EQ" Message-Id: <201108301059.52213.hselasky@c2i.net> Cc: Brett Glass , freebsd-gnats-submit@freebsd.org Subject: Re: usb/160299: MicroSDHC-to-USB adapters do not work in FreeBSD 8.x X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Aug 2011 09:02:31 -0000 --Boundary-00=_IaKXO97fubXM8EQ Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit On Monday 29 August 2011 23:05:30 Brett Glass wrote: > >Number: 160299 > >Category: usb > >Synopsis: MicroSDHC-to-USB adapters do not work in FreeBSD 8.x > >Confidential: no > >Severity: serious > >Priority: high > >Responsible: freebsd-usb > >State: open > >Quarter: > >Keywords: > >Date-Required: > >Class: sw-bug > >Submitter-Id: current-users > >Arrival-Date: Mon Aug 29 21:10:08 UTC 2011 > >Closed-Date: > >Last-Modified: > >Originator: Brett Glass > >Release: FreeBSD 8.1-RELEASE > > >Organization: > LARIAT > > >Environment: > > >Description: > I have tried MicroSDHC cards from several different vendors (Kingston, > Sandisk, etc.), with different MicroSDHC-to-USB adapters (also Kingston > and Sandisk), in FreeBSD 8.x systems. All cause SCSI errors such as > > (da1:umass-sim1:1:0:0): SYNCHRONIZE CACHE(10). CDB: 35 0 0 0 0 0 0 0 0 0 > (da1:umass-sim1:1:0:0): SCSI sense: Error code 0x52 > > Some USB flash memory sticks also produce similar errors. In all cases the > system sometimes hangs in the driver and the memory card or stick gets > quite warm, as if the system is trying the failed operation again and > again. > > It appears that the problem, which has existed since FreeBSD 4.x, is that > the system expects to be able to issue SCSI commands to flash drives > (which are not SCSI drives). As a search of recent PRs reveals, this > problem has been addressed as a "quirk" on a per-device basis for many > individual devices (including memory sticks and cell phones that emulate > them), but keeps recurring as new ones are released. A more general fix is > needed. > > >How-To-Repeat: > Place a MicroSDHC card in a USB adapter and insert in a FreeBSD 8.x > machine. Try to read and write it. > > >Fix: > This behavior is so common that it should not be characterized as a quirk > but as a general property of USB flash devices. All USB flash storage > devices should have SYNCHRONIZE CACHE and similar SCSI commands disabled > by default. These commands should, of course, be enabled for USB-attached > ATAPI rotating media, which supports them. > > >Release-Note: > >Audit-Trail: > > >Unformatted: Hi, Can you try the attached patch and report back. Should work on 8-stable and 9- current. --HPS --Boundary-00=_IaKXO97fubXM8EQ Content-Type: text/x-patch; charset="iso-8859-15"; name="msc_auto_quirk.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="msc_auto_quirk.patch" === sys/dev/usb/quirk/usb_quirk.c ================================================================== --- sys/dev/usb/quirk/usb_quirk.c (revision 225095) +++ sys/dev/usb/quirk/usb_quirk.c (local) @@ -567,9 +567,9 @@ uint16_t x; uint16_t y; - if (quirk == UQ_NONE) { - return (0); - } + if (quirk == UQ_NONE) + goto done; + mtx_lock(&usb_quirk_mtx); for (x = 0; x != USB_DEV_QUIRKS_MAX; x++) { @@ -603,7 +603,8 @@ break; } mtx_unlock(&usb_quirk_mtx); - return (0); +done: + return (usb_test_quirk_w(info, quirk)); } static struct usb_quirk_entry * === sys/dev/usb/usb_device.c ================================================================== --- sys/dev/usb/usb_device.c (revision 225095) +++ sys/dev/usb/usb_device.c (local) @@ -1239,8 +1239,10 @@ usb_init_attach_arg(struct usb_device *udev, struct usb_attach_arg *uaa) { - bzero(uaa, sizeof(*uaa)); + uint8_t x; + memset(uaa, 0, sizeof(*uaa)); + uaa->device = udev; uaa->usb_mode = udev->flags.usb_mode; uaa->port = udev->port_no; @@ -1254,6 +1256,9 @@ uaa->info.bDeviceProtocol = udev->ddesc.bDeviceProtocol; uaa->info.bConfigIndex = udev->curr_config_index; uaa->info.bConfigNum = udev->curr_config_no; + + for (x = 0; x != USB_MAX_AUTO_QUIRK; x++) + uaa->info.autoQuirk[x] = udev->autoQuirk[x]; } /*------------------------------------------------------------------------* @@ -1850,7 +1855,23 @@ } } } + if (set_config_failed == 0 && config_index == 0 && + usb_test_quirk(&uaa, UQ_MSC_NO_SYNC_CACHE) == 0) { + /* + * Try to figure out if there are any MSC quirks we + * should apply automatically: + */ + err = usb_msc_auto_quirk(udev, 0); + + if (err != 0) { + usbd_add_dynamic_quirk(udev, UQ_MSC_NO_SYNC_CACHE); + + set_config_failed = 1; + goto repeat_set_config; + } + } + config_done: DPRINTF("new dev (addr %d), udev=%p, parent_hub=%p\n", udev->address, udev, udev->parent_hub); @@ -2698,3 +2719,16 @@ return (0); /* success */ } +usb_error_t +usbd_add_dynamic_quirk(struct usb_device *udev, uint16_t quirk) +{ + uint8_t x; + + for (x = 0; x != USB_MAX_AUTO_QUIRK; x++) { + if (udev->autoQuirk[x] == 0) { + udev->autoQuirk[x] = quirk; + return (0); /* success */ + } + } + return (USB_ERR_NOMEM); +} === sys/dev/usb/usb_device.h ================================================================== --- sys/dev/usb/usb_device.h (revision 225095) +++ sys/dev/usb/usb_device.h (local) @@ -149,6 +149,7 @@ uint16_t power; /* mA the device uses */ uint16_t langid; /* language for strings */ + uint16_t autoQuirk[USB_MAX_AUTO_QUIRK]; /* dynamic quirks */ uint8_t address; /* device addess */ uint8_t device_index; /* device index in "bus->devices" */ === sys/dev/usb/usb_dynamic.c ================================================================== --- sys/dev/usb/usb_dynamic.c (revision 225095) +++ sys/dev/usb/usb_dynamic.c (local) @@ -50,12 +50,12 @@ #include #include #include +#include /* function prototypes */ static usb_handle_req_t usb_temp_get_desc_w; static usb_temp_setup_by_index_t usb_temp_setup_by_index_w; static usb_temp_unsetup_t usb_temp_unsetup_w; -static usb_test_quirk_t usb_test_quirk_w; static usb_quirk_ioctl_t usb_quirk_ioctl_w; /* global variables */ @@ -72,9 +72,19 @@ return (USB_ERR_INVAL); } -static uint8_t +uint8_t usb_test_quirk_w(const struct usbd_lookup_info *info, uint16_t quirk) { + uint8_t x; + + if (quirk == UQ_NONE) + return (0); /* no match */ + + for (x = 0; x != USB_MAX_AUTO_QUIRK; x++) { + if (info->autoQuirk[x] == quirk) + return (1); /* match */ + } + return (0); /* no match */ } === sys/dev/usb/usb_dynamic.h ================================================================== --- sys/dev/usb/usb_dynamic.h (revision 225095) +++ sys/dev/usb/usb_dynamic.h (local) @@ -57,5 +57,6 @@ void usb_temp_unload(void *); void usb_quirk_unload(void *); void usb_bus_unload(void *); +usb_test_quirk_t usb_test_quirk_w; #endif /* _USB_DYNAMIC_H_ */ === sys/dev/usb/usb_freebsd.h ================================================================== --- sys/dev/usb/usb_freebsd.h (revision 225095) +++ sys/dev/usb/usb_freebsd.h (local) @@ -68,6 +68,8 @@ #define USB_EP0_BUFSIZE 1024 /* bytes */ #define USB_CS_RESET_LIMIT 20 /* failures = 20 * 50 ms = 1sec */ +#define USB_MAX_AUTO_QUIRK 4 /* maximum number of dynamic quirks */ + typedef uint32_t usb_timeout_t; /* milliseconds */ typedef uint32_t usb_frlength_t; /* bytes */ typedef uint32_t usb_frcount_t; /* units */ === sys/dev/usb/usb_msctest.c ================================================================== --- sys/dev/usb/usb_msctest.c (revision 225095) +++ sys/dev/usb/usb_msctest.c (local) @@ -96,6 +96,8 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; static uint8_t scsi_tct_eject[] = { 0x06, 0xf5, 0x04, 0x02, 0x52, 0x70 }; +static uint8_t scsi_sync_cache[] = { 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00 }; #define BULK_SIZE 64 /* dummy */ #define ERR_CSW_FAILED -1 @@ -163,7 +165,7 @@ static void bbb_transfer_start(struct bbb_transfer *, uint8_t); static void bbb_data_clear_stall_callback(struct usb_xfer *, uint8_t, uint8_t); -static uint8_t bbb_command_start(struct bbb_transfer *, uint8_t, uint8_t, +static int bbb_command_start(struct bbb_transfer *, uint8_t, uint8_t, void *, size_t, void *, size_t, usb_timeout_t); static struct bbb_transfer *bbb_attach(struct usb_device *, uint8_t); static void bbb_detach(struct bbb_transfer *); @@ -454,7 +456,7 @@ * 0: Success * Else: Failure *------------------------------------------------------------------------*/ -static uint8_t +static int bbb_command_start(struct bbb_transfer *sc, uint8_t dir, uint8_t lun, void *data_ptr, size_t data_len, void *cmd_ptr, size_t cmd_len, usb_timeout_t data_timeout) @@ -566,9 +568,10 @@ usb_iface_is_cdrom(struct usb_device *udev, uint8_t iface_index) { struct bbb_transfer *sc; - usb_error_t err; - uint8_t timeout, is_cdrom; + uint8_t timeout; + uint8_t is_cdrom; uint8_t sid_type; + int err; sc = bbb_attach(udev, iface_index); if (sc == NULL) @@ -595,6 +598,61 @@ } usb_error_t +usb_msc_auto_quirk(struct usb_device *udev, uint8_t iface_index) +{ + struct bbb_transfer *sc; + uint8_t timeout; + uint8_t is_no_direct; + uint8_t sid_type; + int err; + + sc = bbb_attach(udev, iface_index); + if (sc == NULL) + return (0); + + is_no_direct = 1; + timeout = 4; /* tries */ + while (--timeout) { + err = bbb_command_start(sc, DIR_IN, 0, sc->buffer, + SCSI_INQ_LEN, &scsi_inquiry, sizeof(scsi_inquiry), + USB_MS_HZ); + + if (err == 0 && sc->actlen > 0) { + sid_type = sc->buffer[0] & 0x1F; + if (sid_type == 0x00) + is_no_direct = 0; + break; + } else if (err != ERR_CSW_FAILED) + break; /* non retryable error */ + usb_pause_mtx(NULL, hz); + } + + if (is_no_direct) { + DPRINTF("Device is not direct access.\n"); + goto done; + } + + err = bbb_command_start(sc, DIR_IN, 0, NULL, 0, + &scsi_sync_cache, sizeof(scsi_sync_cache), + USB_MS_HZ); + + if ((err != 0) && (err != ERR_CSW_FAILED)) { + + DPRINTF("Device doesn't handle synchronize cache\n"); + + /* Need to re-enumerate the device */ + usbd_req_re_enumerate(udev, NULL); + + bbb_detach(sc); + return (USB_ERR_STALLED); + } + + done: + bbb_detach(sc); + return (0); +} + +usb_error_t usb_msc_eject(struct usb_device *udev, uint8_t iface_index, int method) { struct bbb_transfer *sc; === sys/dev/usb/usb_msctest.h ================================================================== --- sys/dev/usb/usb_msctest.h (revision 225095) +++ sys/dev/usb/usb_msctest.h (local) @@ -40,5 +40,7 @@ uint8_t iface_index); usb_error_t usb_msc_eject(struct usb_device *udev, uint8_t iface_index, int method); +usb_error_t usb_msc_auto_quirk(struct usb_device *udev, + uint8_t iface_index); #endif /* _USB_MSCTEST_H_ */ === sys/dev/usb/usbdi.h ================================================================== --- sys/dev/usb/usbdi.h (revision 225095) +++ sys/dev/usb/usbdi.h (local) @@ -353,6 +353,7 @@ uint16_t idVendor; uint16_t idProduct; uint16_t bcdDevice; + uint16_t autoQuirk[USB_MAX_AUTO_QUIRK]; uint8_t bDeviceClass; uint8_t bDeviceSubClass; uint8_t bDeviceProtocol; @@ -475,6 +476,8 @@ void usb_pause_mtx(struct mtx *mtx, int _ticks); usb_error_t usbd_set_pnpinfo(struct usb_device *udev, uint8_t iface_index, const char *pnpinfo); +usb_error_t usbd_add_dynamic_quirk(struct usb_device *udev, + uint16_t quirk); const struct usb_device_id *usbd_lookup_id_by_info( const struct usb_device_id *id, usb_size_t sizeof_id, --Boundary-00=_IaKXO97fubXM8EQ-- From owner-freebsd-usb@FreeBSD.ORG Tue Aug 30 09:10:14 2011 Return-Path: Delivered-To: freebsd-usb@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 375B6106566B for ; Tue, 30 Aug 2011 09:10:14 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id DE1258FC0C for ; Tue, 30 Aug 2011 09:10:13 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p7U9AD95052319 for ; Tue, 30 Aug 2011 09:10:13 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p7U9ADPq052318; Tue, 30 Aug 2011 09:10:13 GMT (envelope-from gnats) Date: Tue, 30 Aug 2011 09:10:13 GMT Message-Id: <201108300910.p7U9ADPq052318@freefall.freebsd.org> To: freebsd-usb@FreeBSD.org From: Hans Petter Selasky Cc: Subject: Re: usb/160299: MicroSDHC-to-USB adapters do not work in FreeBSD 8.x X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Hans Petter Selasky List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Aug 2011 09:10:14 -0000 The following reply was made to PR usb/160299; it has been noted by GNATS. From: Hans Petter Selasky To: freebsd-usb@freebsd.org Cc: Brett Glass , freebsd-gnats-submit@freebsd.org Subject: Re: usb/160299: MicroSDHC-to-USB adapters do not work in FreeBSD 8.x Date: Tue, 30 Aug 2011 10:59:52 +0200 --Boundary-00=_IaKXO97fubXM8EQ Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit On Monday 29 August 2011 23:05:30 Brett Glass wrote: > >Number: 160299 > >Category: usb > >Synopsis: MicroSDHC-to-USB adapters do not work in FreeBSD 8.x > >Confidential: no > >Severity: serious > >Priority: high > >Responsible: freebsd-usb > >State: open > >Quarter: > >Keywords: > >Date-Required: > >Class: sw-bug > >Submitter-Id: current-users > >Arrival-Date: Mon Aug 29 21:10:08 UTC 2011 > >Closed-Date: > >Last-Modified: > >Originator: Brett Glass > >Release: FreeBSD 8.1-RELEASE > > >Organization: > LARIAT > > >Environment: > > >Description: > I have tried MicroSDHC cards from several different vendors (Kingston, > Sandisk, etc.), with different MicroSDHC-to-USB adapters (also Kingston > and Sandisk), in FreeBSD 8.x systems. All cause SCSI errors such as > > (da1:umass-sim1:1:0:0): SYNCHRONIZE CACHE(10). CDB: 35 0 0 0 0 0 0 0 0 0 > (da1:umass-sim1:1:0:0): SCSI sense: Error code 0x52 > > Some USB flash memory sticks also produce similar errors. In all cases the > system sometimes hangs in the driver and the memory card or stick gets > quite warm, as if the system is trying the failed operation again and > again. > > It appears that the problem, which has existed since FreeBSD 4.x, is that > the system expects to be able to issue SCSI commands to flash drives > (which are not SCSI drives). As a search of recent PRs reveals, this > problem has been addressed as a "quirk" on a per-device basis for many > individual devices (including memory sticks and cell phones that emulate > them), but keeps recurring as new ones are released. A more general fix is > needed. > > >How-To-Repeat: > Place a MicroSDHC card in a USB adapter and insert in a FreeBSD 8.x > machine. Try to read and write it. > > >Fix: > This behavior is so common that it should not be characterized as a quirk > but as a general property of USB flash devices. All USB flash storage > devices should have SYNCHRONIZE CACHE and similar SCSI commands disabled > by default. These commands should, of course, be enabled for USB-attached > ATAPI rotating media, which supports them. > > >Release-Note: > >Audit-Trail: > > >Unformatted: Hi, Can you try the attached patch and report back. Should work on 8-stable and 9- current. --HPS --Boundary-00=_IaKXO97fubXM8EQ Content-Type: text/x-patch; charset="iso-8859-15"; name="msc_auto_quirk.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="msc_auto_quirk.patch" === sys/dev/usb/quirk/usb_quirk.c ================================================================== --- sys/dev/usb/quirk/usb_quirk.c (revision 225095) +++ sys/dev/usb/quirk/usb_quirk.c (local) @@ -567,9 +567,9 @@ uint16_t x; uint16_t y; - if (quirk == UQ_NONE) { - return (0); - } + if (quirk == UQ_NONE) + goto done; + mtx_lock(&usb_quirk_mtx); for (x = 0; x != USB_DEV_QUIRKS_MAX; x++) { @@ -603,7 +603,8 @@ break; } mtx_unlock(&usb_quirk_mtx); - return (0); +done: + return (usb_test_quirk_w(info, quirk)); } static struct usb_quirk_entry * === sys/dev/usb/usb_device.c ================================================================== --- sys/dev/usb/usb_device.c (revision 225095) +++ sys/dev/usb/usb_device.c (local) @@ -1239,8 +1239,10 @@ usb_init_attach_arg(struct usb_device *udev, struct usb_attach_arg *uaa) { - bzero(uaa, sizeof(*uaa)); + uint8_t x; + memset(uaa, 0, sizeof(*uaa)); + uaa->device = udev; uaa->usb_mode = udev->flags.usb_mode; uaa->port = udev->port_no; @@ -1254,6 +1256,9 @@ uaa->info.bDeviceProtocol = udev->ddesc.bDeviceProtocol; uaa->info.bConfigIndex = udev->curr_config_index; uaa->info.bConfigNum = udev->curr_config_no; + + for (x = 0; x != USB_MAX_AUTO_QUIRK; x++) + uaa->info.autoQuirk[x] = udev->autoQuirk[x]; } /*------------------------------------------------------------------------* @@ -1850,7 +1855,23 @@ } } } + if (set_config_failed == 0 && config_index == 0 && + usb_test_quirk(&uaa, UQ_MSC_NO_SYNC_CACHE) == 0) { + /* + * Try to figure out if there are any MSC quirks we + * should apply automatically: + */ + err = usb_msc_auto_quirk(udev, 0); + + if (err != 0) { + usbd_add_dynamic_quirk(udev, UQ_MSC_NO_SYNC_CACHE); + + set_config_failed = 1; + goto repeat_set_config; + } + } + config_done: DPRINTF("new dev (addr %d), udev=%p, parent_hub=%p\n", udev->address, udev, udev->parent_hub); @@ -2698,3 +2719,16 @@ return (0); /* success */ } +usb_error_t +usbd_add_dynamic_quirk(struct usb_device *udev, uint16_t quirk) +{ + uint8_t x; + + for (x = 0; x != USB_MAX_AUTO_QUIRK; x++) { + if (udev->autoQuirk[x] == 0) { + udev->autoQuirk[x] = quirk; + return (0); /* success */ + } + } + return (USB_ERR_NOMEM); +} === sys/dev/usb/usb_device.h ================================================================== --- sys/dev/usb/usb_device.h (revision 225095) +++ sys/dev/usb/usb_device.h (local) @@ -149,6 +149,7 @@ uint16_t power; /* mA the device uses */ uint16_t langid; /* language for strings */ + uint16_t autoQuirk[USB_MAX_AUTO_QUIRK]; /* dynamic quirks */ uint8_t address; /* device addess */ uint8_t device_index; /* device index in "bus->devices" */ === sys/dev/usb/usb_dynamic.c ================================================================== --- sys/dev/usb/usb_dynamic.c (revision 225095) +++ sys/dev/usb/usb_dynamic.c (local) @@ -50,12 +50,12 @@ #include #include #include +#include /* function prototypes */ static usb_handle_req_t usb_temp_get_desc_w; static usb_temp_setup_by_index_t usb_temp_setup_by_index_w; static usb_temp_unsetup_t usb_temp_unsetup_w; -static usb_test_quirk_t usb_test_quirk_w; static usb_quirk_ioctl_t usb_quirk_ioctl_w; /* global variables */ @@ -72,9 +72,19 @@ return (USB_ERR_INVAL); } -static uint8_t +uint8_t usb_test_quirk_w(const struct usbd_lookup_info *info, uint16_t quirk) { + uint8_t x; + + if (quirk == UQ_NONE) + return (0); /* no match */ + + for (x = 0; x != USB_MAX_AUTO_QUIRK; x++) { + if (info->autoQuirk[x] == quirk) + return (1); /* match */ + } + return (0); /* no match */ } === sys/dev/usb/usb_dynamic.h ================================================================== --- sys/dev/usb/usb_dynamic.h (revision 225095) +++ sys/dev/usb/usb_dynamic.h (local) @@ -57,5 +57,6 @@ void usb_temp_unload(void *); void usb_quirk_unload(void *); void usb_bus_unload(void *); +usb_test_quirk_t usb_test_quirk_w; #endif /* _USB_DYNAMIC_H_ */ === sys/dev/usb/usb_freebsd.h ================================================================== --- sys/dev/usb/usb_freebsd.h (revision 225095) +++ sys/dev/usb/usb_freebsd.h (local) @@ -68,6 +68,8 @@ #define USB_EP0_BUFSIZE 1024 /* bytes */ #define USB_CS_RESET_LIMIT 20 /* failures = 20 * 50 ms = 1sec */ +#define USB_MAX_AUTO_QUIRK 4 /* maximum number of dynamic quirks */ + typedef uint32_t usb_timeout_t; /* milliseconds */ typedef uint32_t usb_frlength_t; /* bytes */ typedef uint32_t usb_frcount_t; /* units */ === sys/dev/usb/usb_msctest.c ================================================================== --- sys/dev/usb/usb_msctest.c (revision 225095) +++ sys/dev/usb/usb_msctest.c (local) @@ -96,6 +96,8 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; static uint8_t scsi_tct_eject[] = { 0x06, 0xf5, 0x04, 0x02, 0x52, 0x70 }; +static uint8_t scsi_sync_cache[] = { 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00 }; #define BULK_SIZE 64 /* dummy */ #define ERR_CSW_FAILED -1 @@ -163,7 +165,7 @@ static void bbb_transfer_start(struct bbb_transfer *, uint8_t); static void bbb_data_clear_stall_callback(struct usb_xfer *, uint8_t, uint8_t); -static uint8_t bbb_command_start(struct bbb_transfer *, uint8_t, uint8_t, +static int bbb_command_start(struct bbb_transfer *, uint8_t, uint8_t, void *, size_t, void *, size_t, usb_timeout_t); static struct bbb_transfer *bbb_attach(struct usb_device *, uint8_t); static void bbb_detach(struct bbb_transfer *); @@ -454,7 +456,7 @@ * 0: Success * Else: Failure *------------------------------------------------------------------------*/ -static uint8_t +static int bbb_command_start(struct bbb_transfer *sc, uint8_t dir, uint8_t lun, void *data_ptr, size_t data_len, void *cmd_ptr, size_t cmd_len, usb_timeout_t data_timeout) @@ -566,9 +568,10 @@ usb_iface_is_cdrom(struct usb_device *udev, uint8_t iface_index) { struct bbb_transfer *sc; - usb_error_t err; - uint8_t timeout, is_cdrom; + uint8_t timeout; + uint8_t is_cdrom; uint8_t sid_type; + int err; sc = bbb_attach(udev, iface_index); if (sc == NULL) @@ -595,6 +598,61 @@ } usb_error_t +usb_msc_auto_quirk(struct usb_device *udev, uint8_t iface_index) +{ + struct bbb_transfer *sc; + uint8_t timeout; + uint8_t is_no_direct; + uint8_t sid_type; + int err; + + sc = bbb_attach(udev, iface_index); + if (sc == NULL) + return (0); + + is_no_direct = 1; + timeout = 4; /* tries */ + while (--timeout) { + err = bbb_command_start(sc, DIR_IN, 0, sc->buffer, + SCSI_INQ_LEN, &scsi_inquiry, sizeof(scsi_inquiry), + USB_MS_HZ); + + if (err == 0 && sc->actlen > 0) { + sid_type = sc->buffer[0] & 0x1F; + if (sid_type == 0x00) + is_no_direct = 0; + break; + } else if (err != ERR_CSW_FAILED) + break; /* non retryable error */ + usb_pause_mtx(NULL, hz); + } + + if (is_no_direct) { + DPRINTF("Device is not direct access.\n"); + goto done; + } + + err = bbb_command_start(sc, DIR_IN, 0, NULL, 0, + &scsi_sync_cache, sizeof(scsi_sync_cache), + USB_MS_HZ); + + if ((err != 0) && (err != ERR_CSW_FAILED)) { + + DPRINTF("Device doesn't handle synchronize cache\n"); + + /* Need to re-enumerate the device */ + usbd_req_re_enumerate(udev, NULL); + + bbb_detach(sc); + return (USB_ERR_STALLED); + } + + done: + bbb_detach(sc); + return (0); +} + +usb_error_t usb_msc_eject(struct usb_device *udev, uint8_t iface_index, int method) { struct bbb_transfer *sc; === sys/dev/usb/usb_msctest.h ================================================================== --- sys/dev/usb/usb_msctest.h (revision 225095) +++ sys/dev/usb/usb_msctest.h (local) @@ -40,5 +40,7 @@ uint8_t iface_index); usb_error_t usb_msc_eject(struct usb_device *udev, uint8_t iface_index, int method); +usb_error_t usb_msc_auto_quirk(struct usb_device *udev, + uint8_t iface_index); #endif /* _USB_MSCTEST_H_ */ === sys/dev/usb/usbdi.h ================================================================== --- sys/dev/usb/usbdi.h (revision 225095) +++ sys/dev/usb/usbdi.h (local) @@ -353,6 +353,7 @@ uint16_t idVendor; uint16_t idProduct; uint16_t bcdDevice; + uint16_t autoQuirk[USB_MAX_AUTO_QUIRK]; uint8_t bDeviceClass; uint8_t bDeviceSubClass; uint8_t bDeviceProtocol; @@ -475,6 +476,8 @@ void usb_pause_mtx(struct mtx *mtx, int _ticks); usb_error_t usbd_set_pnpinfo(struct usb_device *udev, uint8_t iface_index, const char *pnpinfo); +usb_error_t usbd_add_dynamic_quirk(struct usb_device *udev, + uint16_t quirk); const struct usb_device_id *usbd_lookup_id_by_info( const struct usb_device_id *id, usb_size_t sizeof_id, --Boundary-00=_IaKXO97fubXM8EQ-- From owner-freebsd-usb@FreeBSD.ORG Tue Aug 30 11:29:39 2011 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F2CF8106564A; Tue, 30 Aug 2011 11:29:38 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe02.c2i.net [212.247.154.34]) by mx1.freebsd.org (Postfix) with ESMTP id 05C788FC16; Tue, 30 Aug 2011 11:29:36 +0000 (UTC) X-Cloudmark-Score: 0.000000 [] X-Cloudmark-Analysis: v=1.1 cv=EXVNCEO4x3+t9RAkVn3dB6M8qBBSs4D37AbViylCp14= c=1 sm=1 a=Y-1o0aH3NeIA:10 a=WQU8e4WWZSUA:10 a=CL8lFSKtTFcA:10 a=i9M/sDlu2rpZ9XS819oYzg==:17 a=bMxjKQQxBQOViyKbrT8A:9 a=KHLQ6YyG4I_yVJVwkW0A:7 a=PUjeQqilurYA:10 a=sy4OlCgUE1Ks140EvqkA:9 a=SBSt3oKW7HkVKLSlHlsA:7 a=pCZHK7HwvbejYxrK:21 a=-nf5VXhCFM9RZ8TF:21 a=i9M/sDlu2rpZ9XS819oYzg==:117 Received: from [188.126.198.129] (account mc467741@c2i.net HELO laptop002.hselasky.homeunix.org) by mailfe02.swip.net (CommuniGate Pro SMTP 5.2.19) with ESMTPA id 172987986; Tue, 30 Aug 2011 13:29:33 +0200 To: freebsd-usb@freebsd.org From: Hans Petter Selasky X-Face: *nPdTl_}RuAI6^PVpA02T?$%Xa^>@hE0uyUIoiha$pC:9TVgl.Oq,NwSZ4V" =?iso-8859-15?q?=7CLR=2E+tj=7Dg5=0A=09=25V?=,x^qOs~mnU3]Gn; cQLv&.N>TrxmSFf+p6(30a/{)KUU!s}w\IhQBj}[g}bj0I3^glmC( =?iso-8859-15?q?=0A=09=3AAuzV9=3A=2EhESm-x4h240C=609=3Dw?= Date: Tue, 30 Aug 2011 13:26:58 +0200 MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_CkMXOqbZCgU0ukV" Message-Id: <201108301326.58920.hselasky@c2i.net> Cc: Brett Glass , freebsd-gnats-submit@freebsd.org Subject: Re: usb/160299: MicroSDHC-to-USB adapters do not work in FreeBSD 8.x X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Aug 2011 11:29:39 -0000 --Boundary-00=_CkMXOqbZCgU0ukV Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit > >Fix: > This behavior is so common that it should not be characterized as a quirk > but as a general property of USB flash devices. All USB flash storage > devices should have SYNCHRONIZE CACHE and similar SCSI commands disabled > by default. These commands should, of course, be enabled for USB-attached > ATAPI rotating media, which supports them. > > >Release-Note: > >Audit-Trail: > > >Unformatted: Hi, Can everyone using 8-stable or 9-current try this patch and see if it breaks your mass storage device or not: 1) Get latest 8-stable or 9-current sources in /usr/src 2) Apply patch: cd /usr/src cat msc_auto_quirk.patch | patch 3) Build and install new kernel 4) Report back. --HPS --Boundary-00=_CkMXOqbZCgU0ukV Content-Type: text/x-patch; charset="iso-8859-15"; name="msc_auto_quirk.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="msc_auto_quirk.patch" === sys/dev/usb/quirk/usb_quirk.c ================================================================== --- sys/dev/usb/quirk/usb_quirk.c (revision 225095) +++ sys/dev/usb/quirk/usb_quirk.c (local) @@ -148,12 +148,10 @@ UQ_MSC_FORCE_PROTO_SCSI), USB_QUIRK(AIPTEK, POCKETCAM3M, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI), - USB_QUIRK(AIPTEK2, SUNPLUS_TECH, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(ALCOR, SDCR_6335, 0x0000, 0xffff, UQ_MSC_NO_TEST_UNIT_READY, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(ALCOR, SDCR_6362, 0x0000, 0xffff, UQ_MSC_NO_TEST_UNIT_READY, UQ_MSC_NO_SYNC_CACHE), - USB_QUIRK(ALCOR, AU6390, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(ALCOR, UMCR_9361, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_GETMAXLUN), USB_QUIRK(ALCOR, TRANSCEND, 0x0000, 0xffff, UQ_MSC_NO_GETMAXLUN, @@ -173,14 +171,12 @@ USB_QUIRK(CENTURY, EX35QUAT, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_FORCE_SHORT_INQ, UQ_MSC_NO_START_STOP, UQ_MSC_IGNORE_RESIDUE), - USB_QUIRK(CENTURY, EX35SW4_SB4, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(CYPRESS, XX6830XX, 0x0000, 0xffff, UQ_MSC_NO_GETMAXLUN, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(DESKNOTE, UCR_61S2B, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI), USB_QUIRK(DMI, CFSM_RW, 0x0000, 0xffff, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_GETMAXLUN), - USB_QUIRK(DMI, DISK, 0x000, 0xffff, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(EPSON, STYLUS_875DC, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_INQUIRY), USB_QUIRK(EPSON, STYLUS_895, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, @@ -188,7 +184,6 @@ USB_QUIRK(FEIYA, 5IN1, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI), USB_QUIRK(FREECOM, DVD, 0x0000, 0xffff, UQ_MSC_FORCE_PROTO_SCSI), - USB_QUIRK(FREECOM, HDD, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(FUJIPHOTO, MASS0100, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI_I, UQ_MSC_FORCE_PROTO_ATAPI, UQ_MSC_NO_RS_CLEAR_UA, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(GENESYS, GL641USB2IDE, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, @@ -232,7 +227,6 @@ USB_QUIRK(IOMEGA, ZIP100, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_TEST_UNIT_READY), /* XXX ZIP drives can also use ATAPI */ - USB_QUIRK(JMICRON, JM20336, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(JMICRON, JM20337, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_SYNC_CACHE), @@ -279,8 +273,6 @@ UQ_MSC_FORCE_PROTO_ATAPI), USB_QUIRK(MYSON, HEDEN, 0x0000, 0xffff, UQ_MSC_IGNORE_RESIDUE, UQ_MSC_NO_SYNC_CACHE), - USB_QUIRK(MYSON, HEDEN_8813, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), - USB_QUIRK(MYSON, STARREADER, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(NEODIO, ND3260, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_FORCE_SHORT_INQ), USB_QUIRK(NETAC, CF_CARD, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, @@ -317,7 +309,6 @@ USB_QUIRK(PANASONIC, KXLCB35AN, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI), USB_QUIRK(PANASONIC, LS120CAM, 0x0000, 0xffff, UQ_MSC_FORCE_PROTO_UFI), - USB_QUIRK(PHILIPS, SPE3030CC, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(PLEXTOR, 40_12_40U, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_TEST_UNIT_READY), USB_QUIRK(PNY, ATTACHE2, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, @@ -328,7 +319,6 @@ USB_QUIRK_VP(USB_VENDOR_SAMSUNG_TECHWIN, USB_PRODUCT_SAMSUNG_TECHWIN_DIGIMAX_410, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_INQUIRY), - USB_QUIRK(SAMSUNG, YP_U4, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(SANDISK, SDDR05A, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_READ_CAP_OFFBY1, UQ_MSC_NO_GETMAXLUN), @@ -448,12 +438,6 @@ UQ_MSC_FORCE_PROTO_ATAPI), USB_QUIRK(MEIZU, M6_SL, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_INQUIRY, UQ_MSC_NO_SYNC_CACHE), - USB_QUIRK(ACTIONS, MP4, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, - UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_SYNC_CACHE), - USB_QUIRK(ASUS, GMSC, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), - USB_QUIRK(CHIPSBANK, USBMEMSTICK, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), - USB_QUIRK(CHIPSBANK, USBMEMSTICK1, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), - USB_QUIRK(NEWLINK, USB2IDEBRIDGE, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), /* Non-standard USB MIDI devices */ USB_QUIRK(ROLAND, UM1, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), @@ -567,9 +551,9 @@ uint16_t x; uint16_t y; - if (quirk == UQ_NONE) { - return (0); - } + if (quirk == UQ_NONE) + goto done; + mtx_lock(&usb_quirk_mtx); for (x = 0; x != USB_DEV_QUIRKS_MAX; x++) { @@ -603,7 +587,8 @@ break; } mtx_unlock(&usb_quirk_mtx); - return (0); +done: + return (usb_test_quirk_w(info, quirk)); } static struct usb_quirk_entry * === sys/dev/usb/storage/umass.c ================================================================== --- sys/dev/usb/storage/umass.c (revision 225095) +++ sys/dev/usb/storage/umass.c (local) @@ -1025,12 +1025,6 @@ sc->cam_scsi_sense.opcode = REQUEST_SENSE; sc->cam_scsi_test_unit_ready.opcode = TEST_UNIT_READY; - /* - * some devices need a delay after that the configuration value is - * set to function properly: - */ - usb_pause_mtx(NULL, hz); - /* register the SIM */ err = umass_cam_attach_sim(sc); if (err) { === sys/dev/usb/usb_device.c ================================================================== --- sys/dev/usb/usb_device.c (revision 225095) +++ sys/dev/usb/usb_device.c (local) @@ -1239,8 +1239,10 @@ usb_init_attach_arg(struct usb_device *udev, struct usb_attach_arg *uaa) { - bzero(uaa, sizeof(*uaa)); + uint8_t x; + memset(uaa, 0, sizeof(*uaa)); + uaa->device = udev; uaa->usb_mode = udev->flags.usb_mode; uaa->port = udev->port_no; @@ -1254,6 +1256,9 @@ uaa->info.bDeviceProtocol = udev->ddesc.bDeviceProtocol; uaa->info.bConfigIndex = udev->curr_config_index; uaa->info.bConfigNum = udev->curr_config_no; + + for (x = 0; x != USB_MAX_AUTO_QUIRK; x++) + uaa->info.autoQuirk[x] = udev->autoQuirk[x]; } /*------------------------------------------------------------------------* @@ -1850,7 +1855,21 @@ } } } + if (set_config_failed == 0 && config_index == 0 && + usb_test_quirk(&uaa, UQ_MSC_NO_SYNC_CACHE) == 0) { + /* + * Try to figure out if there are any MSC quirks we + * should apply automatically: + */ + err = usb_msc_auto_quirk(udev, 0); + + if (err != 0) { + set_config_failed = 1; + goto repeat_set_config; + } + } + config_done: DPRINTF("new dev (addr %d), udev=%p, parent_hub=%p\n", udev->address, udev, udev->parent_hub); @@ -2698,3 +2717,16 @@ return (0); /* success */ } +usb_error_t +usbd_add_dynamic_quirk(struct usb_device *udev, uint16_t quirk) +{ + uint8_t x; + + for (x = 0; x != USB_MAX_AUTO_QUIRK; x++) { + if (udev->autoQuirk[x] == 0) { + udev->autoQuirk[x] = quirk; + return (0); /* success */ + } + } + return (USB_ERR_NOMEM); +} === sys/dev/usb/usb_device.h ================================================================== --- sys/dev/usb/usb_device.h (revision 225095) +++ sys/dev/usb/usb_device.h (local) @@ -149,6 +149,7 @@ uint16_t power; /* mA the device uses */ uint16_t langid; /* language for strings */ + uint16_t autoQuirk[USB_MAX_AUTO_QUIRK]; /* dynamic quirks */ uint8_t address; /* device addess */ uint8_t device_index; /* device index in "bus->devices" */ === sys/dev/usb/usb_dynamic.c ================================================================== --- sys/dev/usb/usb_dynamic.c (revision 225095) +++ sys/dev/usb/usb_dynamic.c (local) @@ -50,12 +50,12 @@ #include #include #include +#include /* function prototypes */ static usb_handle_req_t usb_temp_get_desc_w; static usb_temp_setup_by_index_t usb_temp_setup_by_index_w; static usb_temp_unsetup_t usb_temp_unsetup_w; -static usb_test_quirk_t usb_test_quirk_w; static usb_quirk_ioctl_t usb_quirk_ioctl_w; /* global variables */ @@ -72,9 +72,19 @@ return (USB_ERR_INVAL); } -static uint8_t +uint8_t usb_test_quirk_w(const struct usbd_lookup_info *info, uint16_t quirk) { + uint8_t x; + + if (quirk == UQ_NONE) + return (0); /* no match */ + + for (x = 0; x != USB_MAX_AUTO_QUIRK; x++) { + if (info->autoQuirk[x] == quirk) + return (1); /* match */ + } + return (0); /* no match */ } === sys/dev/usb/usb_dynamic.h ================================================================== --- sys/dev/usb/usb_dynamic.h (revision 225095) +++ sys/dev/usb/usb_dynamic.h (local) @@ -57,5 +57,6 @@ void usb_temp_unload(void *); void usb_quirk_unload(void *); void usb_bus_unload(void *); +usb_test_quirk_t usb_test_quirk_w; #endif /* _USB_DYNAMIC_H_ */ === sys/dev/usb/usb_freebsd.h ================================================================== --- sys/dev/usb/usb_freebsd.h (revision 225095) +++ sys/dev/usb/usb_freebsd.h (local) @@ -68,6 +68,8 @@ #define USB_EP0_BUFSIZE 1024 /* bytes */ #define USB_CS_RESET_LIMIT 20 /* failures = 20 * 50 ms = 1sec */ +#define USB_MAX_AUTO_QUIRK 4 /* maximum number of dynamic quirks */ + typedef uint32_t usb_timeout_t; /* milliseconds */ typedef uint32_t usb_frlength_t; /* bytes */ typedef uint32_t usb_frcount_t; /* units */ === sys/dev/usb/usb_msctest.c ================================================================== --- sys/dev/usb/usb_msctest.c (revision 225095) +++ sys/dev/usb/usb_msctest.c (local) @@ -96,6 +96,8 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; static uint8_t scsi_tct_eject[] = { 0x06, 0xf5, 0x04, 0x02, 0x52, 0x70 }; +static uint8_t scsi_sync_cache[] = { 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00 }; #define BULK_SIZE 64 /* dummy */ #define ERR_CSW_FAILED -1 @@ -163,7 +165,7 @@ static void bbb_transfer_start(struct bbb_transfer *, uint8_t); static void bbb_data_clear_stall_callback(struct usb_xfer *, uint8_t, uint8_t); -static uint8_t bbb_command_start(struct bbb_transfer *, uint8_t, uint8_t, +static int bbb_command_start(struct bbb_transfer *, uint8_t, uint8_t, void *, size_t, void *, size_t, usb_timeout_t); static struct bbb_transfer *bbb_attach(struct usb_device *, uint8_t); static void bbb_detach(struct bbb_transfer *); @@ -454,7 +456,7 @@ * 0: Success * Else: Failure *------------------------------------------------------------------------*/ -static uint8_t +static int bbb_command_start(struct bbb_transfer *sc, uint8_t dir, uint8_t lun, void *data_ptr, size_t data_len, void *cmd_ptr, size_t cmd_len, usb_timeout_t data_timeout) @@ -566,9 +568,10 @@ usb_iface_is_cdrom(struct usb_device *udev, uint8_t iface_index) { struct bbb_transfer *sc; - usb_error_t err; - uint8_t timeout, is_cdrom; + uint8_t timeout; + uint8_t is_cdrom; uint8_t sid_type; + int err; sc = bbb_attach(udev, iface_index); if (sc == NULL) @@ -595,6 +598,88 @@ } usb_error_t +usb_msc_auto_quirk(struct usb_device *udev, uint8_t iface_index) +{ + struct bbb_transfer *sc; + uint8_t timeout; + uint8_t is_no_direct; + uint8_t sid_type; + int err; + + sc = bbb_attach(udev, iface_index); + if (sc == NULL) + return (0); + + /* + * Some devices need a delay after that the configuration + * value is set to function properly: + */ + usb_pause_mtx(NULL, hz); + + is_no_direct = 1; + for (timeout = 4; timeout; timeout--) { + err = bbb_command_start(sc, DIR_IN, 0, sc->buffer, + SCSI_INQ_LEN, &scsi_inquiry, sizeof(scsi_inquiry), + USB_MS_HZ); + + if (err == 0 && sc->actlen > 0) { + sid_type = sc->buffer[0] & 0x1F; + if (sid_type == 0x00) + is_no_direct = 0; + break; + } else if (err != ERR_CSW_FAILED) + break; /* non retryable error */ + usb_pause_mtx(NULL, hz); + } + + if (is_no_direct) { + DPRINTF("Device is not direct access.\n"); + goto done; + } + + err = bbb_command_start(sc, DIR_IN, 0, NULL, 0, + &scsi_test_unit_ready, sizeof(scsi_test_unit_ready), + USB_MS_HZ); + + if (err != 0) { + + if (err != ERR_CSW_FAILED) + goto error; + } + + err = bbb_command_start(sc, DIR_IN, 0, NULL, 0, + &scsi_sync_cache, sizeof(scsi_sync_cache), + USB_MS_HZ); + + if (err != 0) { + + if (err != ERR_CSW_FAILED) + goto error; + + DPRINTF("Device doesn't handle synchronize cache\n"); + + usbd_add_dynamic_quirk(udev, UQ_MSC_NO_SYNC_CACHE); + } + +done: + bbb_detach(sc); + return (0); + +error: + bbb_detach(sc); + + DPRINTF("Device did not respond, enabling all quirks\n"); + + usbd_add_dynamic_quirk(udev, UQ_MSC_NO_SYNC_CACHE); + usbd_add_dynamic_quirk(udev, UQ_MSC_NO_TEST_UNIT_READY); + + /* Need to re-enumerate the device */ + usbd_req_re_enumerate(udev, NULL); + + return (USB_ERR_STALLED); +} + +usb_error_t usb_msc_eject(struct usb_device *udev, uint8_t iface_index, int method) { struct bbb_transfer *sc; === sys/dev/usb/usb_msctest.h ================================================================== --- sys/dev/usb/usb_msctest.h (revision 225095) +++ sys/dev/usb/usb_msctest.h (local) @@ -40,5 +40,7 @@ uint8_t iface_index); usb_error_t usb_msc_eject(struct usb_device *udev, uint8_t iface_index, int method); +usb_error_t usb_msc_auto_quirk(struct usb_device *udev, + uint8_t iface_index); #endif /* _USB_MSCTEST_H_ */ === sys/dev/usb/usbdi.h ================================================================== --- sys/dev/usb/usbdi.h (revision 225095) +++ sys/dev/usb/usbdi.h (local) @@ -353,6 +353,7 @@ uint16_t idVendor; uint16_t idProduct; uint16_t bcdDevice; + uint16_t autoQuirk[USB_MAX_AUTO_QUIRK]; uint8_t bDeviceClass; uint8_t bDeviceSubClass; uint8_t bDeviceProtocol; @@ -475,6 +476,8 @@ void usb_pause_mtx(struct mtx *mtx, int _ticks); usb_error_t usbd_set_pnpinfo(struct usb_device *udev, uint8_t iface_index, const char *pnpinfo); +usb_error_t usbd_add_dynamic_quirk(struct usb_device *udev, + uint16_t quirk); const struct usb_device_id *usbd_lookup_id_by_info( const struct usb_device_id *id, usb_size_t sizeof_id, --Boundary-00=_CkMXOqbZCgU0ukV-- From owner-freebsd-usb@FreeBSD.ORG Tue Aug 30 11:30:15 2011 Return-Path: Delivered-To: freebsd-usb@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 82A1B1065678 for ; Tue, 30 Aug 2011 11:30:15 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 714348FC0A for ; Tue, 30 Aug 2011 11:30:15 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p7UBUFIO083855 for ; Tue, 30 Aug 2011 11:30:15 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p7UBUFMv083852; Tue, 30 Aug 2011 11:30:15 GMT (envelope-from gnats) Date: Tue, 30 Aug 2011 11:30:15 GMT Message-Id: <201108301130.p7UBUFMv083852@freefall.freebsd.org> To: freebsd-usb@FreeBSD.org From: Hans Petter Selasky Cc: Subject: Re: usb/160299: MicroSDHC-to-USB adapters do not work in FreeBSD 8.x X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Hans Petter Selasky List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Aug 2011 11:30:15 -0000 The following reply was made to PR usb/160299; it has been noted by GNATS. From: Hans Petter Selasky To: freebsd-usb@freebsd.org Cc: Brett Glass , freebsd-gnats-submit@freebsd.org Subject: Re: usb/160299: MicroSDHC-to-USB adapters do not work in FreeBSD 8.x Date: Tue, 30 Aug 2011 13:26:58 +0200 --Boundary-00=_CkMXOqbZCgU0ukV Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit > >Fix: > This behavior is so common that it should not be characterized as a quirk > but as a general property of USB flash devices. All USB flash storage > devices should have SYNCHRONIZE CACHE and similar SCSI commands disabled > by default. These commands should, of course, be enabled for USB-attached > ATAPI rotating media, which supports them. > > >Release-Note: > >Audit-Trail: > > >Unformatted: Hi, Can everyone using 8-stable or 9-current try this patch and see if it breaks your mass storage device or not: 1) Get latest 8-stable or 9-current sources in /usr/src 2) Apply patch: cd /usr/src cat msc_auto_quirk.patch | patch 3) Build and install new kernel 4) Report back. --HPS --Boundary-00=_CkMXOqbZCgU0ukV Content-Type: text/x-patch; charset="iso-8859-15"; name="msc_auto_quirk.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="msc_auto_quirk.patch" === sys/dev/usb/quirk/usb_quirk.c ================================================================== --- sys/dev/usb/quirk/usb_quirk.c (revision 225095) +++ sys/dev/usb/quirk/usb_quirk.c (local) @@ -148,12 +148,10 @@ UQ_MSC_FORCE_PROTO_SCSI), USB_QUIRK(AIPTEK, POCKETCAM3M, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI), - USB_QUIRK(AIPTEK2, SUNPLUS_TECH, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(ALCOR, SDCR_6335, 0x0000, 0xffff, UQ_MSC_NO_TEST_UNIT_READY, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(ALCOR, SDCR_6362, 0x0000, 0xffff, UQ_MSC_NO_TEST_UNIT_READY, UQ_MSC_NO_SYNC_CACHE), - USB_QUIRK(ALCOR, AU6390, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(ALCOR, UMCR_9361, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_GETMAXLUN), USB_QUIRK(ALCOR, TRANSCEND, 0x0000, 0xffff, UQ_MSC_NO_GETMAXLUN, @@ -173,14 +171,12 @@ USB_QUIRK(CENTURY, EX35QUAT, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_FORCE_SHORT_INQ, UQ_MSC_NO_START_STOP, UQ_MSC_IGNORE_RESIDUE), - USB_QUIRK(CENTURY, EX35SW4_SB4, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(CYPRESS, XX6830XX, 0x0000, 0xffff, UQ_MSC_NO_GETMAXLUN, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(DESKNOTE, UCR_61S2B, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI), USB_QUIRK(DMI, CFSM_RW, 0x0000, 0xffff, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_GETMAXLUN), - USB_QUIRK(DMI, DISK, 0x000, 0xffff, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(EPSON, STYLUS_875DC, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_INQUIRY), USB_QUIRK(EPSON, STYLUS_895, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, @@ -188,7 +184,6 @@ USB_QUIRK(FEIYA, 5IN1, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI), USB_QUIRK(FREECOM, DVD, 0x0000, 0xffff, UQ_MSC_FORCE_PROTO_SCSI), - USB_QUIRK(FREECOM, HDD, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(FUJIPHOTO, MASS0100, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI_I, UQ_MSC_FORCE_PROTO_ATAPI, UQ_MSC_NO_RS_CLEAR_UA, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(GENESYS, GL641USB2IDE, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, @@ -232,7 +227,6 @@ USB_QUIRK(IOMEGA, ZIP100, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_TEST_UNIT_READY), /* XXX ZIP drives can also use ATAPI */ - USB_QUIRK(JMICRON, JM20336, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(JMICRON, JM20337, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_SYNC_CACHE), @@ -279,8 +273,6 @@ UQ_MSC_FORCE_PROTO_ATAPI), USB_QUIRK(MYSON, HEDEN, 0x0000, 0xffff, UQ_MSC_IGNORE_RESIDUE, UQ_MSC_NO_SYNC_CACHE), - USB_QUIRK(MYSON, HEDEN_8813, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), - USB_QUIRK(MYSON, STARREADER, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(NEODIO, ND3260, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_FORCE_SHORT_INQ), USB_QUIRK(NETAC, CF_CARD, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, @@ -317,7 +309,6 @@ USB_QUIRK(PANASONIC, KXLCB35AN, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI), USB_QUIRK(PANASONIC, LS120CAM, 0x0000, 0xffff, UQ_MSC_FORCE_PROTO_UFI), - USB_QUIRK(PHILIPS, SPE3030CC, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(PLEXTOR, 40_12_40U, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_TEST_UNIT_READY), USB_QUIRK(PNY, ATTACHE2, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, @@ -328,7 +319,6 @@ USB_QUIRK_VP(USB_VENDOR_SAMSUNG_TECHWIN, USB_PRODUCT_SAMSUNG_TECHWIN_DIGIMAX_410, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_INQUIRY), - USB_QUIRK(SAMSUNG, YP_U4, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(SANDISK, SDDR05A, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_READ_CAP_OFFBY1, UQ_MSC_NO_GETMAXLUN), @@ -448,12 +438,6 @@ UQ_MSC_FORCE_PROTO_ATAPI), USB_QUIRK(MEIZU, M6_SL, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_INQUIRY, UQ_MSC_NO_SYNC_CACHE), - USB_QUIRK(ACTIONS, MP4, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, - UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_SYNC_CACHE), - USB_QUIRK(ASUS, GMSC, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), - USB_QUIRK(CHIPSBANK, USBMEMSTICK, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), - USB_QUIRK(CHIPSBANK, USBMEMSTICK1, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), - USB_QUIRK(NEWLINK, USB2IDEBRIDGE, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), /* Non-standard USB MIDI devices */ USB_QUIRK(ROLAND, UM1, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), @@ -567,9 +551,9 @@ uint16_t x; uint16_t y; - if (quirk == UQ_NONE) { - return (0); - } + if (quirk == UQ_NONE) + goto done; + mtx_lock(&usb_quirk_mtx); for (x = 0; x != USB_DEV_QUIRKS_MAX; x++) { @@ -603,7 +587,8 @@ break; } mtx_unlock(&usb_quirk_mtx); - return (0); +done: + return (usb_test_quirk_w(info, quirk)); } static struct usb_quirk_entry * === sys/dev/usb/storage/umass.c ================================================================== --- sys/dev/usb/storage/umass.c (revision 225095) +++ sys/dev/usb/storage/umass.c (local) @@ -1025,12 +1025,6 @@ sc->cam_scsi_sense.opcode = REQUEST_SENSE; sc->cam_scsi_test_unit_ready.opcode = TEST_UNIT_READY; - /* - * some devices need a delay after that the configuration value is - * set to function properly: - */ - usb_pause_mtx(NULL, hz); - /* register the SIM */ err = umass_cam_attach_sim(sc); if (err) { === sys/dev/usb/usb_device.c ================================================================== --- sys/dev/usb/usb_device.c (revision 225095) +++ sys/dev/usb/usb_device.c (local) @@ -1239,8 +1239,10 @@ usb_init_attach_arg(struct usb_device *udev, struct usb_attach_arg *uaa) { - bzero(uaa, sizeof(*uaa)); + uint8_t x; + memset(uaa, 0, sizeof(*uaa)); + uaa->device = udev; uaa->usb_mode = udev->flags.usb_mode; uaa->port = udev->port_no; @@ -1254,6 +1256,9 @@ uaa->info.bDeviceProtocol = udev->ddesc.bDeviceProtocol; uaa->info.bConfigIndex = udev->curr_config_index; uaa->info.bConfigNum = udev->curr_config_no; + + for (x = 0; x != USB_MAX_AUTO_QUIRK; x++) + uaa->info.autoQuirk[x] = udev->autoQuirk[x]; } /*------------------------------------------------------------------------* @@ -1850,7 +1855,21 @@ } } } + if (set_config_failed == 0 && config_index == 0 && + usb_test_quirk(&uaa, UQ_MSC_NO_SYNC_CACHE) == 0) { + /* + * Try to figure out if there are any MSC quirks we + * should apply automatically: + */ + err = usb_msc_auto_quirk(udev, 0); + + if (err != 0) { + set_config_failed = 1; + goto repeat_set_config; + } + } + config_done: DPRINTF("new dev (addr %d), udev=%p, parent_hub=%p\n", udev->address, udev, udev->parent_hub); @@ -2698,3 +2717,16 @@ return (0); /* success */ } +usb_error_t +usbd_add_dynamic_quirk(struct usb_device *udev, uint16_t quirk) +{ + uint8_t x; + + for (x = 0; x != USB_MAX_AUTO_QUIRK; x++) { + if (udev->autoQuirk[x] == 0) { + udev->autoQuirk[x] = quirk; + return (0); /* success */ + } + } + return (USB_ERR_NOMEM); +} === sys/dev/usb/usb_device.h ================================================================== --- sys/dev/usb/usb_device.h (revision 225095) +++ sys/dev/usb/usb_device.h (local) @@ -149,6 +149,7 @@ uint16_t power; /* mA the device uses */ uint16_t langid; /* language for strings */ + uint16_t autoQuirk[USB_MAX_AUTO_QUIRK]; /* dynamic quirks */ uint8_t address; /* device addess */ uint8_t device_index; /* device index in "bus->devices" */ === sys/dev/usb/usb_dynamic.c ================================================================== --- sys/dev/usb/usb_dynamic.c (revision 225095) +++ sys/dev/usb/usb_dynamic.c (local) @@ -50,12 +50,12 @@ #include #include #include +#include /* function prototypes */ static usb_handle_req_t usb_temp_get_desc_w; static usb_temp_setup_by_index_t usb_temp_setup_by_index_w; static usb_temp_unsetup_t usb_temp_unsetup_w; -static usb_test_quirk_t usb_test_quirk_w; static usb_quirk_ioctl_t usb_quirk_ioctl_w; /* global variables */ @@ -72,9 +72,19 @@ return (USB_ERR_INVAL); } -static uint8_t +uint8_t usb_test_quirk_w(const struct usbd_lookup_info *info, uint16_t quirk) { + uint8_t x; + + if (quirk == UQ_NONE) + return (0); /* no match */ + + for (x = 0; x != USB_MAX_AUTO_QUIRK; x++) { + if (info->autoQuirk[x] == quirk) + return (1); /* match */ + } + return (0); /* no match */ } === sys/dev/usb/usb_dynamic.h ================================================================== --- sys/dev/usb/usb_dynamic.h (revision 225095) +++ sys/dev/usb/usb_dynamic.h (local) @@ -57,5 +57,6 @@ void usb_temp_unload(void *); void usb_quirk_unload(void *); void usb_bus_unload(void *); +usb_test_quirk_t usb_test_quirk_w; #endif /* _USB_DYNAMIC_H_ */ === sys/dev/usb/usb_freebsd.h ================================================================== --- sys/dev/usb/usb_freebsd.h (revision 225095) +++ sys/dev/usb/usb_freebsd.h (local) @@ -68,6 +68,8 @@ #define USB_EP0_BUFSIZE 1024 /* bytes */ #define USB_CS_RESET_LIMIT 20 /* failures = 20 * 50 ms = 1sec */ +#define USB_MAX_AUTO_QUIRK 4 /* maximum number of dynamic quirks */ + typedef uint32_t usb_timeout_t; /* milliseconds */ typedef uint32_t usb_frlength_t; /* bytes */ typedef uint32_t usb_frcount_t; /* units */ === sys/dev/usb/usb_msctest.c ================================================================== --- sys/dev/usb/usb_msctest.c (revision 225095) +++ sys/dev/usb/usb_msctest.c (local) @@ -96,6 +96,8 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; static uint8_t scsi_tct_eject[] = { 0x06, 0xf5, 0x04, 0x02, 0x52, 0x70 }; +static uint8_t scsi_sync_cache[] = { 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00 }; #define BULK_SIZE 64 /* dummy */ #define ERR_CSW_FAILED -1 @@ -163,7 +165,7 @@ static void bbb_transfer_start(struct bbb_transfer *, uint8_t); static void bbb_data_clear_stall_callback(struct usb_xfer *, uint8_t, uint8_t); -static uint8_t bbb_command_start(struct bbb_transfer *, uint8_t, uint8_t, +static int bbb_command_start(struct bbb_transfer *, uint8_t, uint8_t, void *, size_t, void *, size_t, usb_timeout_t); static struct bbb_transfer *bbb_attach(struct usb_device *, uint8_t); static void bbb_detach(struct bbb_transfer *); @@ -454,7 +456,7 @@ * 0: Success * Else: Failure *------------------------------------------------------------------------*/ -static uint8_t +static int bbb_command_start(struct bbb_transfer *sc, uint8_t dir, uint8_t lun, void *data_ptr, size_t data_len, void *cmd_ptr, size_t cmd_len, usb_timeout_t data_timeout) @@ -566,9 +568,10 @@ usb_iface_is_cdrom(struct usb_device *udev, uint8_t iface_index) { struct bbb_transfer *sc; - usb_error_t err; - uint8_t timeout, is_cdrom; + uint8_t timeout; + uint8_t is_cdrom; uint8_t sid_type; + int err; sc = bbb_attach(udev, iface_index); if (sc == NULL) @@ -595,6 +598,88 @@ } usb_error_t +usb_msc_auto_quirk(struct usb_device *udev, uint8_t iface_index) +{ + struct bbb_transfer *sc; + uint8_t timeout; + uint8_t is_no_direct; + uint8_t sid_type; + int err; + + sc = bbb_attach(udev, iface_index); + if (sc == NULL) + return (0); + + /* + * Some devices need a delay after that the configuration + * value is set to function properly: + */ + usb_pause_mtx(NULL, hz); + + is_no_direct = 1; + for (timeout = 4; timeout; timeout--) { + err = bbb_command_start(sc, DIR_IN, 0, sc->buffer, + SCSI_INQ_LEN, &scsi_inquiry, sizeof(scsi_inquiry), + USB_MS_HZ); + + if (err == 0 && sc->actlen > 0) { + sid_type = sc->buffer[0] & 0x1F; + if (sid_type == 0x00) + is_no_direct = 0; + break; + } else if (err != ERR_CSW_FAILED) + break; /* non retryable error */ + usb_pause_mtx(NULL, hz); + } + + if (is_no_direct) { + DPRINTF("Device is not direct access.\n"); + goto done; + } + + err = bbb_command_start(sc, DIR_IN, 0, NULL, 0, + &scsi_test_unit_ready, sizeof(scsi_test_unit_ready), + USB_MS_HZ); + + if (err != 0) { + + if (err != ERR_CSW_FAILED) + goto error; + } + + err = bbb_command_start(sc, DIR_IN, 0, NULL, 0, + &scsi_sync_cache, sizeof(scsi_sync_cache), + USB_MS_HZ); + + if (err != 0) { + + if (err != ERR_CSW_FAILED) + goto error; + + DPRINTF("Device doesn't handle synchronize cache\n"); + + usbd_add_dynamic_quirk(udev, UQ_MSC_NO_SYNC_CACHE); + } + +done: + bbb_detach(sc); + return (0); + +error: + bbb_detach(sc); + + DPRINTF("Device did not respond, enabling all quirks\n"); + + usbd_add_dynamic_quirk(udev, UQ_MSC_NO_SYNC_CACHE); + usbd_add_dynamic_quirk(udev, UQ_MSC_NO_TEST_UNIT_READY); + + /* Need to re-enumerate the device */ + usbd_req_re_enumerate(udev, NULL); + + return (USB_ERR_STALLED); +} + +usb_error_t usb_msc_eject(struct usb_device *udev, uint8_t iface_index, int method) { struct bbb_transfer *sc; === sys/dev/usb/usb_msctest.h ================================================================== --- sys/dev/usb/usb_msctest.h (revision 225095) +++ sys/dev/usb/usb_msctest.h (local) @@ -40,5 +40,7 @@ uint8_t iface_index); usb_error_t usb_msc_eject(struct usb_device *udev, uint8_t iface_index, int method); +usb_error_t usb_msc_auto_quirk(struct usb_device *udev, + uint8_t iface_index); #endif /* _USB_MSCTEST_H_ */ === sys/dev/usb/usbdi.h ================================================================== --- sys/dev/usb/usbdi.h (revision 225095) +++ sys/dev/usb/usbdi.h (local) @@ -353,6 +353,7 @@ uint16_t idVendor; uint16_t idProduct; uint16_t bcdDevice; + uint16_t autoQuirk[USB_MAX_AUTO_QUIRK]; uint8_t bDeviceClass; uint8_t bDeviceSubClass; uint8_t bDeviceProtocol; @@ -475,6 +476,8 @@ void usb_pause_mtx(struct mtx *mtx, int _ticks); usb_error_t usbd_set_pnpinfo(struct usb_device *udev, uint8_t iface_index, const char *pnpinfo); +usb_error_t usbd_add_dynamic_quirk(struct usb_device *udev, + uint16_t quirk); const struct usb_device_id *usbd_lookup_id_by_info( const struct usb_device_id *id, usb_size_t sizeof_id, --Boundary-00=_CkMXOqbZCgU0ukV-- From owner-freebsd-usb@FreeBSD.ORG Tue Aug 30 16:58:14 2011 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 739DD106566C; Tue, 30 Aug 2011 16:58:14 +0000 (UTC) (envelope-from brett@lariat.net) Received: from lariat.net (lariat.net [66.119.58.2]) by mx1.freebsd.org (Postfix) with ESMTP id C59158FC08; Tue, 30 Aug 2011 16:58:13 +0000 (UTC) Received: from WildRover.lariat.net (IDENT:ppp1000.lariat.net@lariat.net [66.119.58.2]) by lariat.net (8.9.3/8.9.3) with ESMTP id KAA01353; Tue, 30 Aug 2011 10:36:09 -0600 (MDT) Message-Id: <201108301636.KAA01353@lariat.net> X-Mailer: QUALCOMM Windows Eudora Version 7.1.0.9 Date: Tue, 30 Aug 2011 10:36:02 -0600 To: Hans Petter Selasky , freebsd-usb@freebsd.org From: Brett Glass In-Reply-To: <201108301326.58920.hselasky@c2i.net> References: <201108301326.58920.hselasky@c2i.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Cc: Brett Glass , freebsd-gnats-submit@freebsd.org Subject: Re: usb/160299: MicroSDHC-to-USB adapters do not work in FreeBSD 8.x X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Aug 2011 16:58:14 -0000 Hans: This would help. Empirical testing of the device isn't as good as recognizing that it's a flash drive or flash adapter, but it might help with unusual devices such as cellular phones and USB CD-ROM drives. --Brett Glass From owner-freebsd-usb@FreeBSD.ORG Tue Aug 30 17:00:23 2011 Return-Path: Delivered-To: freebsd-usb@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AA489106566B for ; Tue, 30 Aug 2011 17:00:23 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 7F8A98FC0A for ; Tue, 30 Aug 2011 17:00:23 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p7UH0N1r093329 for ; Tue, 30 Aug 2011 17:00:23 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p7UH0NeK093324; Tue, 30 Aug 2011 17:00:23 GMT (envelope-from gnats) Date: Tue, 30 Aug 2011 17:00:23 GMT Message-Id: <201108301700.p7UH0NeK093324@freefall.freebsd.org> To: freebsd-usb@FreeBSD.org From: Brett Glass Cc: Subject: Re: usb/160299: MicroSDHC-to-USB adapters do not work in FreeBSD 8.x X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Brett Glass List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Aug 2011 17:00:23 -0000 The following reply was made to PR usb/160299; it has been noted by GNATS. From: Brett Glass To: Hans Petter Selasky , freebsd-usb@freebsd.org Cc: Brett Glass , freebsd-gnats-submit@freebsd.org Subject: Re: usb/160299: MicroSDHC-to-USB adapters do not work in FreeBSD 8.x Date: Tue, 30 Aug 2011 10:36:02 -0600 Hans: This would help. Empirical testing of the device isn't as good as recognizing that it's a flash drive or flash adapter, but it might help with unusual devices such as cellular phones and USB CD-ROM drives. --Brett Glass From owner-freebsd-usb@FreeBSD.ORG Wed Aug 31 06:23:16 2011 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2062A106566B for ; Wed, 31 Aug 2011 06:23:16 +0000 (UTC) (envelope-from rocky.tseng@gmail.com) Received: from sam.nabble.com (sam.nabble.com [216.139.236.26]) by mx1.freebsd.org (Postfix) with ESMTP id EAB598FC12 for ; Wed, 31 Aug 2011 06:23:15 +0000 (UTC) Received: from [192.168.236.26] (helo=sam.nabble.com) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1Qydu0-00074x-CB for freebsd-usb@freebsd.org; Tue, 30 Aug 2011 23:03:56 -0700 Date: Tue, 30 Aug 2011 23:03:56 -0700 (PDT) From: rockytseng To: freebsd-usb@freebsd.org Message-ID: <1314770636371-4753025.post@n5.nabble.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: About nanoBSD boot speed slowly X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Aug 2011 06:23:16 -0000 Dear all: the nanoBSD project was very well,but i have a problem now,it's the boot time very long,i need 3 minutes for disk boot time when after BIOS finished and before kernel be load,Can you give me a solution for this problem?My setting file as follows,thank's your support... rocky << My Environment >> Operation System:FreeBSD 8.2 RELEASE Compact Flash:Transcend 4GB(Industrial) OS Installation Options: Developer setup PS:The Discussion area for nanoBSD was very few in taiwan,can you told to me about Discussion area where to go?thank you very much << nano config=>UOS_v101.conf >> # Name of this NanoBSD build. (Used to construct workdir names) NANO_NAME=UOS_v101 # Source tree directory NANO_SRC=/usr/src # Where nanobsd additional files live under the source tree NANO_TOOLS=tools/tools/nanobsd # Where cust_pkg() finds packages to install NANO_PACKAGE_DIR=${NANO_SRC}/${NANO_TOOLS}/Pkg NANO_PACKAGE_LIST="*" # Object tree directory # default is subdir of /usr/obj #NANO_OBJ="" # The directory to put the final images # default is ${NANO_OBJ} #NANO_DISKIMGDIR="" # Parallel Make NANO_PMAKE="make -j 8" # The default name for any image we create. #NANO_IMGNAME="_.disk.full" # Options to put in make.conf during buildworld only CONF_BUILD=' NO_KLD_LOAD=YES NO_NETGRAPH=YES NO_PAM=YES #PPP_NO_NETGRAPH=YES #PPP_NO_RADIUS=YES ' # Options to put in make.conf during installworld only CONF_INSTALL=' NO_AUTHPF=YES NO_BLUETOOTH=YES NO_CVS=YES NO_DICT=YES NO_FORTRAN=YES NO_GDB=YES NO_HTML=YES NO_LPR=YES NO_PROFILE=YES NO_SENDMAIL=YES NO_SHAREDOCS=YES NO_EXAMPLES=YES NO_INSTALLLIB=YES NO_CALENDAR=YES NO_MISC=YES NO_MAKE=YES ' # Options to put in make.conf during both build- & installworld. CONF_WORLD=' NO_ATM=YES NO_I4B=YES NO_INET6=YES NO_NIS=YES NO_RCMDS=YES NO_GAMES=YES NO_RESCUE=YES #PPP_NO_NETGRAPH=YES #PPP_NO_RADIUS=YES NO_LOCALS=YES NO_NLS=YES NO_PCVT=YES NO_IPX=YES NO_INFO=YES ' # Kernel config file to use NANO_KERNEL=GENERIC_nano # Customize commands. #NANO_CUSTOMIZE="" # Late customize commands. #NANO_LATE_CUSTOMIZE="" # Newfs paramters to use #NANO_NEWFS="-b 4096 -f 512 -i 8192 -O1 -U" # The drive name of the media at runtime NANO_DRIVE=ad0 # Target media size in 512 bytes sectors #NANO_MEDIASIZE=393216 # Number of code images on media (1 or 2) NANO_IMAGES=2 # 0 -> Leave second image all zeroes so it compresses better. # 1 -> Initialize second image with a copy of the first #NANO_INIT_IMG2=0 # Size of code file system in 512 bytes sectors # If zero, size will be as large as possible. NANO_CODESIZE=524288 # Size of configuration file system in 512 bytes sectors # Cannot be zero. NANO_CONFSIZE=10240 # Size of data file system in 512 bytes sectors # If zero: no partition configured. # If negative: max size possible NANO_DATASIZE=0 # Size of the /etc ramdisk in 512 bytes sectors NANO_RAM_ETCSIZE=10240 # Size of the /tmp+/var ramdisk in 512 bytes sectors NANO_RAM_TMPVARSIZE=10240 # Media geometry, only relevant if bios doesn't understand LBA. #NANO_SECTS=63 #NANO_HEADS=16 # boot0 flags/options and configuration NANO_BOOT0CFG="-o packet -s 1 -m 3" NANO_BOOTLOADER="boot/boot0sio" # boot2 flags/options # default force serial console #NANO_BOOT2CFG="-h" # Backing type of md(4) device # Can be "file" or "swap" NANO_MD_BACKING="file" # Progress Print level PPLEVEL=3 FlashDevice transcend 4g cust_nobeastie()( touch ${NANO_WORLDDIR}/boot/loader.conf echo "beastie_disable=\"YES\"" >> ${NANO_WORLDDIR}/boot/loader.conf ) customize_cmd cust_pkg #customize_cmd cust_comconsole customize_cmd cust_install_files customize_cmd cust_allow_ssh_root customize_cmd cust_nobeastie << Kernel >> cpu I586_CPU cpu I686_CPU ident Nano_0825 # To statically compile in device wiring instead of /boot/device.hints #hints "GENERIC.hints" # Default places to look for devices. # Use the following to compile in values accessible to the kernel # through getenv() (or kenv(1) in userland). The format of the file # is 'variable=value', see kenv(1) # # env "GENERIC.env" makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols options SCHED_ULE # ULE scheduler options PREEMPTION # Enable kernel thread preemption options INET # InterNETworking #options INET6 # IPv6 communications protocols options SCTP # Stream Control Transmission Protocol options FFS # Berkeley Fast Filesystem options SOFTUPDATES # Enable FFS soft updates support options UFS_ACL # Support for access control lists options UFS_DIRHASH # Improve performance on big directories options UFS_GJOURNAL # Enable gjournal-based UFS journaling options MD_ROOT # MD is a potential root device #options NFSCLIENT # Network Filesystem Client #options NFSSERVER # Network Filesystem Server #options NFSLOCKD # Network Lock Manager #options NFS_ROOT # NFS usable as /, requires NFSCLIENT options MSDOSFS # MSDOS Filesystem options CD9660 # ISO 9660 Filesystem options PROCFS # Process filesystem (requires PSEUDOFS) options PSEUDOFS # Pseudo-filesystem framework options GEOM_PART_GPT # GUID Partition Tables. options GEOM_LABEL # Provides labelization options COMPAT_43TTY # BSD 4.3 TTY compat (sgtty) #options COMPAT_FREEBSD4 # Compatible with FreeBSD4 options COMPAT_FREEBSD5 # Compatible with FreeBSD5 options COMPAT_FREEBSD6 # Compatible with FreeBSD6 options COMPAT_FREEBSD7 # Compatible with FreeBSD7 options SCSI_DELAY=5000 # Delay (in ms) before probing SCSI options KTRACE # ktrace(1) support options STACK # stack(9) support options SYSVSHM # SYSV-style shared memory options SYSVMSG # SYSV-style message queues options SYSVSEM # SYSV-style semaphores options P1003_1B_SEMAPHORES # POSIX-style semaphores options _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions options PRINTF_BUFR_SIZE=128 # Prevent printf output being interspersed. options KBD_INSTALL_CDEV # install a CDEV entry in /dev options HWPMC_HOOKS # Necessary kernel hooks for hwpmc(4) options AUDIT # Security event auditing options MAC # TrustedBSD MAC Framework options FLOWTABLE # per-cpu routing cache #options KDTRACE_HOOKS # Kernel DTrace hooks options INCLUDE_CONFIG_FILE # Include this file in kernel options KDB # Kernel debugger related code options KDB_TRACE # Print a stack trace for a panic # To make an SMP kernel, the next two lines are needed options SMP # Symmetric MultiProcessor Kernel device apic # I/O APIC # CPU frequency control device cpufreq # Bus support. device acpi device eisa device pci # ATA and ATAPI devices device ata device atadisk # ATA disk drives device ataraid # ATA RAID drives device atapicd # ATAPI CDROM drives #device atapifd # ATAPI floppy drives #device atapist # ATAPI tape drives options ATA_STATIC_ID # Static device numbering # SCSI peripherals device scbus # SCSI bus (required for SCSI) device ch # SCSI media changers device da # Direct Access (disks) device sa # Sequential Access (tape etc) device cd # CD device pass # Passthrough device (direct SCSI access) device ses # SCSI Environmental Services (and SAF-TE) # atkbdc0 controls both the keyboard and the PS/2 mouse device atkbdc # AT keyboard controller device atkbd # AT keyboard device psm # PS/2 mouse #device kbdmux # keyboard multiplexer device vga # VGA video card driver device splash # Splash screen and screen saver support # syscons is the default console driver, resembling an SCO console device sc device agp # support several AGP chipsets # Power management support (see NOTES for more options) #device apm # Add suspend/resume support for the i8254. device pmtimer # PCCARD (PCMCIA) support # PCMCIA and cardbus bridge support device cbb # cardbus (yenta) bridge device pccard # PC Card (16-bit) bus device cardbus # CardBus (32-bit) bus # Serial (COM) ports device uart # Generic UART driver # Parallel port device ppc device ppbus # Parallel port bus (required) # PCI Ethernet NICs that use the common MII bus controller code. # NOTE: Be sure to keep the 'device miibus' line in order to use these NICs! device miibus # MII bus support device rl # RealTek 8129/8139 # Pseudo devices. device loop # Network loopback device random # Entropy device device ether # Ethernet support device vlan # 802.1Q VLAN support device tun # Packet tunnel. device pty # BSD-style compatibility pseudo ttys device md # Memory "disks" device firmware # firmware assist module # The `bpf' device enables the Berkeley Packet Filter. # Be aware of the administrative consequences of enabling this! # Note that 'bpf' is required for DHCP. device bpf # Berkeley packet filter # USB support options USB_DEBUG # enable debug msgs device uhci # UHCI PCI->USB interface device ohci # OHCI PCI->USB interface device ehci # EHCI PCI->USB interface (USB 2.0) device usb # USB Bus (required) device uhid # "Human Interface Devices" device umass # Disks/Mass storage - Requires scbus and da PS:The Discussion area for nanoBSD was very few in taiwan,can you told to me about Discussion area where to go?thank you very much -- View this message in context: http://freebsd.1045724.n5.nabble.com/About-nanoBSD-boot-speed-slowly-tp4753025p4753025.html Sent from the freebsd-usb mailing list archive at Nabble.com. From owner-freebsd-usb@FreeBSD.ORG Wed Aug 31 07:04:18 2011 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 70164106566B for ; Wed, 31 Aug 2011 07:04:18 +0000 (UTC) (envelope-from do-not-reply@utc.com) Received: from mx0b-00105401.pphosted.com (mx0b-00105401.pphosted.com [67.231.152.184]) by mx1.freebsd.org (Postfix) with ESMTP id 21A118FC0C for ; Wed, 31 Aug 2011 07:04:17 +0000 (UTC) Received: from pps.filterd (m0004038 [127.0.0.1]) by mx0b-00105401.pphosted.com (8.14.4/8.14.4) with SMTP id p7V5mhAP002393 for ; Wed, 31 Aug 2011 01:51:06 -0400 Received: from pps.reply (localhost [127.0.0.1]) by mx0b-00105401.pphosted.com with ESMTP id yhevf0unn-1 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 31 Aug 2011 01:51:06 -0400 Received: from m0004038 (m0004038 [127.0.0.1]) by pps.reply (8.14.1/8.14.1) with SMTP id p7V5p6XQ014103 for ; Wed, 31 Aug 2011 01:51:06 -0400 Date: Wed, 31 Aug 2011 01:51:06 -0400 TO: freebsd-usb@freebsd.org FROM: do-not-reply@utc.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit Message-ID: X-Proofpoint-Sentinel: stfsU2FsdGVkX1/ZEz9o6zdQOkyLUDIV+dWFLBtdJUYJ9safZZIdpJcx1jNm N02MV0rzW5Mh0gMX3XSMDs/CEWM2CnYESC+QZkqA48hNpJRPSCcc1b4byjvSOoCAsaeJYIIR Subject: Re: Boguxcoibmopkef - attachment(s) deleted X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Aug 2011 07:04:18 -0000 The message you sent to larry.carlson@hs.utc.com contained one or more executable files which were deleted per UTC corporate policy. Deleted File(s): larry.carlson@hs.utc.com If there is a business need for sending the attachment(s), please resend as a password protected .zip archive. From owner-freebsd-usb@FreeBSD.ORG Thu Sep 1 06:10:11 2011 Return-Path: Delivered-To: freebsd-usb@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2F0941065672 for ; Thu, 1 Sep 2011 06:10:11 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 059DA8FC14 for ; Thu, 1 Sep 2011 06:10:11 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p816AAen089873 for ; Thu, 1 Sep 2011 06:10:10 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p816AAKv089872; Thu, 1 Sep 2011 06:10:10 GMT (envelope-from gnats) Date: Thu, 1 Sep 2011 06:10:10 GMT Message-Id: <201109010610.p816AAKv089872@freefall.freebsd.org> To: freebsd-usb@FreeBSD.org From: "deeptech71@gmail.com" Cc: Subject: Re: usb/76732: [ums] Mouse problems with USB KVM Switch X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: "deeptech71@gmail.com" List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Sep 2011 06:10:11 -0000 The following reply was made to PR usb/76732; it has been noted by GNATS. From: "deeptech71@gmail.com" To: bug-followup@freebsd.org Cc: Subject: Re: usb/76732: [ums] Mouse problems with USB KVM Switch Date: Thu, 1 Sep 2011 08:03:51 +0200 btw, see the resolution of ports/137748. From owner-freebsd-usb@FreeBSD.ORG Fri Sep 2 19:00:29 2011 Return-Path: Delivered-To: freebsd-usb@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1EE261065686 for ; Fri, 2 Sep 2011 19:00:29 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 1E6778FC18 for ; Fri, 2 Sep 2011 19:00:28 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p82J0SgD001396 for ; Fri, 2 Sep 2011 19:00:28 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p82J0Sig001395; Fri, 2 Sep 2011 19:00:28 GMT (envelope-from gnats) Date: Fri, 2 Sep 2011 19:00:28 GMT Message-Id: <201109021900.p82J0Sig001395@freefall.freebsd.org> To: freebsd-usb@FreeBSD.org From: dfilter@FreeBSD.ORG (dfilter service) Cc: Subject: Re: usb/160299: commit references a PR X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: dfilter service List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Sep 2011 19:00:29 -0000 The following reply was made to PR usb/160299; it has been noted by GNATS. From: dfilter@FreeBSD.ORG (dfilter service) To: bug-followup@FreeBSD.org Cc: Subject: Re: usb/160299: commit references a PR Date: Fri, 2 Sep 2011 18:50:59 +0000 (UTC) Author: hselasky Date: Fri Sep 2 18:50:44 2011 New Revision: 225350 URL: http://svn.freebsd.org/changeset/base/225350 Log: This patch adds automatic detection of USB mass storage devices which does not support the no synchronize cache SCSI command. The __FreeBSD_version version macro has been bumped and external kernel modules needs to be recompiled after this patch. Approved by: re (kib) MFC after: 1 week PR: usb/160299 Modified: head/sys/dev/usb/quirk/usb_quirk.c head/sys/dev/usb/storage/umass.c head/sys/dev/usb/usb_device.c head/sys/dev/usb/usb_device.h head/sys/dev/usb/usb_dynamic.c head/sys/dev/usb/usb_dynamic.h head/sys/dev/usb/usb_freebsd.h head/sys/dev/usb/usb_msctest.c head/sys/dev/usb/usb_msctest.h head/sys/dev/usb/usbdi.h head/sys/sys/param.h Modified: head/sys/dev/usb/quirk/usb_quirk.c ============================================================================== --- head/sys/dev/usb/quirk/usb_quirk.c Fri Sep 2 18:44:57 2011 (r225349) +++ head/sys/dev/usb/quirk/usb_quirk.c Fri Sep 2 18:50:44 2011 (r225350) @@ -148,12 +148,10 @@ static struct usb_quirk_entry usb_quirks UQ_MSC_FORCE_PROTO_SCSI), USB_QUIRK(AIPTEK, POCKETCAM3M, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI), - USB_QUIRK(AIPTEK2, SUNPLUS_TECH, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(ALCOR, SDCR_6335, 0x0000, 0xffff, UQ_MSC_NO_TEST_UNIT_READY, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(ALCOR, SDCR_6362, 0x0000, 0xffff, UQ_MSC_NO_TEST_UNIT_READY, UQ_MSC_NO_SYNC_CACHE), - USB_QUIRK(ALCOR, AU6390, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(ALCOR, UMCR_9361, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_GETMAXLUN), USB_QUIRK(ALCOR, TRANSCEND, 0x0000, 0xffff, UQ_MSC_NO_GETMAXLUN, @@ -173,14 +171,12 @@ static struct usb_quirk_entry usb_quirks USB_QUIRK(CENTURY, EX35QUAT, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_FORCE_SHORT_INQ, UQ_MSC_NO_START_STOP, UQ_MSC_IGNORE_RESIDUE), - USB_QUIRK(CENTURY, EX35SW4_SB4, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(CYPRESS, XX6830XX, 0x0000, 0xffff, UQ_MSC_NO_GETMAXLUN, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(DESKNOTE, UCR_61S2B, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI), USB_QUIRK(DMI, CFSM_RW, 0x0000, 0xffff, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_GETMAXLUN), - USB_QUIRK(DMI, DISK, 0x000, 0xffff, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(EPSON, STYLUS_875DC, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_INQUIRY), USB_QUIRK(EPSON, STYLUS_895, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, @@ -188,7 +184,6 @@ static struct usb_quirk_entry usb_quirks USB_QUIRK(FEIYA, 5IN1, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI), USB_QUIRK(FREECOM, DVD, 0x0000, 0xffff, UQ_MSC_FORCE_PROTO_SCSI), - USB_QUIRK(FREECOM, HDD, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(FUJIPHOTO, MASS0100, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI_I, UQ_MSC_FORCE_PROTO_ATAPI, UQ_MSC_NO_RS_CLEAR_UA, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(GENESYS, GL641USB2IDE, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, @@ -232,7 +227,6 @@ static struct usb_quirk_entry usb_quirks USB_QUIRK(IOMEGA, ZIP100, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_TEST_UNIT_READY), /* XXX ZIP drives can also use ATAPI */ - USB_QUIRK(JMICRON, JM20336, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(JMICRON, JM20337, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_SYNC_CACHE), @@ -279,8 +273,6 @@ static struct usb_quirk_entry usb_quirks UQ_MSC_FORCE_PROTO_ATAPI), USB_QUIRK(MYSON, HEDEN, 0x0000, 0xffff, UQ_MSC_IGNORE_RESIDUE, UQ_MSC_NO_SYNC_CACHE), - USB_QUIRK(MYSON, HEDEN_8813, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), - USB_QUIRK(MYSON, STARREADER, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(NEODIO, ND3260, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_FORCE_SHORT_INQ), USB_QUIRK(NETAC, CF_CARD, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, @@ -317,7 +309,6 @@ static struct usb_quirk_entry usb_quirks USB_QUIRK(PANASONIC, KXLCB35AN, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI), USB_QUIRK(PANASONIC, LS120CAM, 0x0000, 0xffff, UQ_MSC_FORCE_PROTO_UFI), - USB_QUIRK(PHILIPS, SPE3030CC, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(PLEXTOR, 40_12_40U, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_TEST_UNIT_READY), USB_QUIRK(PNY, ATTACHE2, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, @@ -328,7 +319,6 @@ static struct usb_quirk_entry usb_quirks USB_QUIRK_VP(USB_VENDOR_SAMSUNG_TECHWIN, USB_PRODUCT_SAMSUNG_TECHWIN_DIGIMAX_410, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_INQUIRY), - USB_QUIRK(SAMSUNG, YP_U4, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(SANDISK, SDDR05A, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_READ_CAP_OFFBY1, UQ_MSC_NO_GETMAXLUN), @@ -448,12 +438,6 @@ static struct usb_quirk_entry usb_quirks UQ_MSC_FORCE_PROTO_ATAPI), USB_QUIRK(MEIZU, M6_SL, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_INQUIRY, UQ_MSC_NO_SYNC_CACHE), - USB_QUIRK(ACTIONS, MP4, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, - UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_SYNC_CACHE), - USB_QUIRK(ASUS, GMSC, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), - USB_QUIRK(CHIPSBANK, USBMEMSTICK, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), - USB_QUIRK(CHIPSBANK, USBMEMSTICK1, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), - USB_QUIRK(NEWLINK, USB2IDEBRIDGE, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), /* Non-standard USB MIDI devices */ USB_QUIRK(ROLAND, UM1, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), @@ -567,9 +551,9 @@ usb_test_quirk_by_info(const struct usbd uint16_t x; uint16_t y; - if (quirk == UQ_NONE) { - return (0); - } + if (quirk == UQ_NONE) + goto done; + mtx_lock(&usb_quirk_mtx); for (x = 0; x != USB_DEV_QUIRKS_MAX; x++) { @@ -603,7 +587,8 @@ usb_test_quirk_by_info(const struct usbd break; } mtx_unlock(&usb_quirk_mtx); - return (0); +done: + return (usb_test_quirk_w(info, quirk)); } static struct usb_quirk_entry * Modified: head/sys/dev/usb/storage/umass.c ============================================================================== --- head/sys/dev/usb/storage/umass.c Fri Sep 2 18:44:57 2011 (r225349) +++ head/sys/dev/usb/storage/umass.c Fri Sep 2 18:50:44 2011 (r225350) @@ -1025,12 +1025,6 @@ umass_attach(device_t dev) sc->cam_scsi_sense.opcode = REQUEST_SENSE; sc->cam_scsi_test_unit_ready.opcode = TEST_UNIT_READY; - /* - * some devices need a delay after that the configuration value is - * set to function properly: - */ - usb_pause_mtx(NULL, hz); - /* register the SIM */ err = umass_cam_attach_sim(sc); if (err) { Modified: head/sys/dev/usb/usb_device.c ============================================================================== --- head/sys/dev/usb/usb_device.c Fri Sep 2 18:44:57 2011 (r225349) +++ head/sys/dev/usb/usb_device.c Fri Sep 2 18:50:44 2011 (r225350) @@ -1239,7 +1239,9 @@ static void usb_init_attach_arg(struct usb_device *udev, struct usb_attach_arg *uaa) { - bzero(uaa, sizeof(*uaa)); + uint8_t x; + + memset(uaa, 0, sizeof(*uaa)); uaa->device = udev; uaa->usb_mode = udev->flags.usb_mode; @@ -1254,6 +1256,9 @@ usb_init_attach_arg(struct usb_device *u uaa->info.bDeviceProtocol = udev->ddesc.bDeviceProtocol; uaa->info.bConfigIndex = udev->curr_config_index; uaa->info.bConfigNum = udev->curr_config_no; + + for (x = 0; x != USB_MAX_AUTO_QUIRK; x++) + uaa->info.autoQuirk[x] = udev->autoQuirk[x]; } /*------------------------------------------------------------------------* @@ -1850,6 +1855,20 @@ repeat_set_config: } } } + if (set_config_failed == 0 && config_index == 0 && + usb_test_quirk(&uaa, UQ_MSC_NO_SYNC_CACHE) == 0) { + + /* + * Try to figure out if there are any MSC quirks we + * should apply automatically: + */ + err = usb_msc_auto_quirk(udev, 0); + + if (err != 0) { + set_config_failed = 1; + goto repeat_set_config; + } + } config_done: DPRINTF("new dev (addr %d), udev=%p, parent_hub=%p\n", @@ -2698,3 +2717,16 @@ usbd_set_pnpinfo(struct usb_device *udev return (0); /* success */ } +usb_error_t +usbd_add_dynamic_quirk(struct usb_device *udev, uint16_t quirk) +{ + uint8_t x; + + for (x = 0; x != USB_MAX_AUTO_QUIRK; x++) { + if (udev->autoQuirk[x] == 0) { + udev->autoQuirk[x] = quirk; + return (0); /* success */ + } + } + return (USB_ERR_NOMEM); +} Modified: head/sys/dev/usb/usb_device.h ============================================================================== --- head/sys/dev/usb/usb_device.h Fri Sep 2 18:44:57 2011 (r225349) +++ head/sys/dev/usb/usb_device.h Fri Sep 2 18:50:44 2011 (r225350) @@ -149,6 +149,7 @@ struct usb_device { uint16_t power; /* mA the device uses */ uint16_t langid; /* language for strings */ + uint16_t autoQuirk[USB_MAX_AUTO_QUIRK]; /* dynamic quirks */ uint8_t address; /* device addess */ uint8_t device_index; /* device index in "bus->devices" */ Modified: head/sys/dev/usb/usb_dynamic.c ============================================================================== --- head/sys/dev/usb/usb_dynamic.c Fri Sep 2 18:44:57 2011 (r225349) +++ head/sys/dev/usb/usb_dynamic.c Fri Sep 2 18:50:44 2011 (r225350) @@ -50,12 +50,12 @@ #include #include #include +#include /* function prototypes */ static usb_handle_req_t usb_temp_get_desc_w; static usb_temp_setup_by_index_t usb_temp_setup_by_index_w; static usb_temp_unsetup_t usb_temp_unsetup_w; -static usb_test_quirk_t usb_test_quirk_w; static usb_quirk_ioctl_t usb_quirk_ioctl_w; /* global variables */ @@ -72,9 +72,19 @@ usb_temp_setup_by_index_w(struct usb_dev return (USB_ERR_INVAL); } -static uint8_t +uint8_t usb_test_quirk_w(const struct usbd_lookup_info *info, uint16_t quirk) { + uint8_t x; + + if (quirk == UQ_NONE) + return (0); /* no match */ + + for (x = 0; x != USB_MAX_AUTO_QUIRK; x++) { + if (info->autoQuirk[x] == quirk) + return (1); /* match */ + } + return (0); /* no match */ } Modified: head/sys/dev/usb/usb_dynamic.h ============================================================================== --- head/sys/dev/usb/usb_dynamic.h Fri Sep 2 18:44:57 2011 (r225349) +++ head/sys/dev/usb/usb_dynamic.h Fri Sep 2 18:50:44 2011 (r225350) @@ -57,5 +57,6 @@ extern devclass_t usb_devclass_ptr; void usb_temp_unload(void *); void usb_quirk_unload(void *); void usb_bus_unload(void *); +usb_test_quirk_t usb_test_quirk_w; #endif /* _USB_DYNAMIC_H_ */ Modified: head/sys/dev/usb/usb_freebsd.h ============================================================================== --- head/sys/dev/usb/usb_freebsd.h Fri Sep 2 18:44:57 2011 (r225349) +++ head/sys/dev/usb/usb_freebsd.h Fri Sep 2 18:50:44 2011 (r225350) @@ -68,6 +68,8 @@ #define USB_EP0_BUFSIZE 1024 /* bytes */ #define USB_CS_RESET_LIMIT 20 /* failures = 20 * 50 ms = 1sec */ +#define USB_MAX_AUTO_QUIRK 4 /* maximum number of dynamic quirks */ + typedef uint32_t usb_timeout_t; /* milliseconds */ typedef uint32_t usb_frlength_t; /* bytes */ typedef uint32_t usb_frcount_t; /* units */ Modified: head/sys/dev/usb/usb_msctest.c ============================================================================== --- head/sys/dev/usb/usb_msctest.c Fri Sep 2 18:44:57 2011 (r225349) +++ head/sys/dev/usb/usb_msctest.c Fri Sep 2 18:50:44 2011 (r225350) @@ -96,6 +96,8 @@ static uint8_t scsi_huawei_eject[] = { 0 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; static uint8_t scsi_tct_eject[] = { 0x06, 0xf5, 0x04, 0x02, 0x52, 0x70 }; +static uint8_t scsi_sync_cache[] = { 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00 }; #define BULK_SIZE 64 /* dummy */ #define ERR_CSW_FAILED -1 @@ -163,7 +165,7 @@ static void bbb_done(struct bbb_transfer static void bbb_transfer_start(struct bbb_transfer *, uint8_t); static void bbb_data_clear_stall_callback(struct usb_xfer *, uint8_t, uint8_t); -static uint8_t bbb_command_start(struct bbb_transfer *, uint8_t, uint8_t, +static int bbb_command_start(struct bbb_transfer *, uint8_t, uint8_t, void *, size_t, void *, size_t, usb_timeout_t); static struct bbb_transfer *bbb_attach(struct usb_device *, uint8_t); static void bbb_detach(struct bbb_transfer *); @@ -454,7 +456,7 @@ bbb_status_callback(struct usb_xfer *xfe * 0: Success * Else: Failure *------------------------------------------------------------------------*/ -static uint8_t +static int bbb_command_start(struct bbb_transfer *sc, uint8_t dir, uint8_t lun, void *data_ptr, size_t data_len, void *cmd_ptr, size_t cmd_len, usb_timeout_t data_timeout) @@ -566,9 +568,10 @@ int usb_iface_is_cdrom(struct usb_device *udev, uint8_t iface_index) { struct bbb_transfer *sc; - usb_error_t err; - uint8_t timeout, is_cdrom; + uint8_t timeout; + uint8_t is_cdrom; uint8_t sid_type; + int err; sc = bbb_attach(udev, iface_index); if (sc == NULL) @@ -595,6 +598,88 @@ usb_iface_is_cdrom(struct usb_device *ud } usb_error_t +usb_msc_auto_quirk(struct usb_device *udev, uint8_t iface_index) +{ + struct bbb_transfer *sc; + uint8_t timeout; + uint8_t is_no_direct; + uint8_t sid_type; + int err; + + sc = bbb_attach(udev, iface_index); + if (sc == NULL) + return (0); + + /* + * Some devices need a delay after that the configuration + * value is set to function properly: + */ + usb_pause_mtx(NULL, hz); + + is_no_direct = 1; + for (timeout = 4; timeout; timeout--) { + err = bbb_command_start(sc, DIR_IN, 0, sc->buffer, + SCSI_INQ_LEN, &scsi_inquiry, sizeof(scsi_inquiry), + USB_MS_HZ); + + if (err == 0 && sc->actlen > 0) { + sid_type = sc->buffer[0] & 0x1F; + if (sid_type == 0x00) + is_no_direct = 0; + break; + } else if (err != ERR_CSW_FAILED) + break; /* non retryable error */ + usb_pause_mtx(NULL, hz); + } + + if (is_no_direct) { + DPRINTF("Device is not direct access.\n"); + goto done; + } + + err = bbb_command_start(sc, DIR_IN, 0, NULL, 0, + &scsi_test_unit_ready, sizeof(scsi_test_unit_ready), + USB_MS_HZ); + + if (err != 0) { + + if (err != ERR_CSW_FAILED) + goto error; + } + + err = bbb_command_start(sc, DIR_IN, 0, NULL, 0, + &scsi_sync_cache, sizeof(scsi_sync_cache), + USB_MS_HZ); + + if (err != 0) { + + if (err != ERR_CSW_FAILED) + goto error; + + DPRINTF("Device doesn't handle synchronize cache\n"); + + usbd_add_dynamic_quirk(udev, UQ_MSC_NO_SYNC_CACHE); + } + +done: + bbb_detach(sc); + return (0); + +error: + bbb_detach(sc); + + DPRINTF("Device did not respond, enabling all quirks\n"); + + usbd_add_dynamic_quirk(udev, UQ_MSC_NO_SYNC_CACHE); + usbd_add_dynamic_quirk(udev, UQ_MSC_NO_TEST_UNIT_READY); + + /* Need to re-enumerate the device */ + usbd_req_re_enumerate(udev, NULL); + + return (USB_ERR_STALLED); +} + +usb_error_t usb_msc_eject(struct usb_device *udev, uint8_t iface_index, int method) { struct bbb_transfer *sc; Modified: head/sys/dev/usb/usb_msctest.h ============================================================================== --- head/sys/dev/usb/usb_msctest.h Fri Sep 2 18:44:57 2011 (r225349) +++ head/sys/dev/usb/usb_msctest.h Fri Sep 2 18:50:44 2011 (r225350) @@ -40,5 +40,7 @@ int usb_iface_is_cdrom(struct usb_device uint8_t iface_index); usb_error_t usb_msc_eject(struct usb_device *udev, uint8_t iface_index, int method); +usb_error_t usb_msc_auto_quirk(struct usb_device *udev, + uint8_t iface_index); #endif /* _USB_MSCTEST_H_ */ Modified: head/sys/dev/usb/usbdi.h ============================================================================== --- head/sys/dev/usb/usbdi.h Fri Sep 2 18:44:57 2011 (r225349) +++ head/sys/dev/usb/usbdi.h Fri Sep 2 18:50:44 2011 (r225350) @@ -353,6 +353,7 @@ struct usbd_lookup_info { uint16_t idVendor; uint16_t idProduct; uint16_t bcdDevice; + uint16_t autoQuirk[USB_MAX_AUTO_QUIRK]; uint8_t bDeviceClass; uint8_t bDeviceSubClass; uint8_t bDeviceProtocol; @@ -475,6 +476,8 @@ void device_set_usb_desc(device_t dev); void usb_pause_mtx(struct mtx *mtx, int _ticks); usb_error_t usbd_set_pnpinfo(struct usb_device *udev, uint8_t iface_index, const char *pnpinfo); +usb_error_t usbd_add_dynamic_quirk(struct usb_device *udev, + uint16_t quirk); const struct usb_device_id *usbd_lookup_id_by_info( const struct usb_device_id *id, usb_size_t sizeof_id, Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Fri Sep 2 18:44:57 2011 (r225349) +++ head/sys/sys/param.h Fri Sep 2 18:50:44 2011 (r225350) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 900042 /* Master, propagated to newvers */ +#define __FreeBSD_version 900043 /* Master, propagated to newvers */ #ifdef _KERNEL #define P_OSREL_SIGSEGV 700004 _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" From owner-freebsd-usb@FreeBSD.ORG Sat Sep 3 20:00:21 2011 Return-Path: Delivered-To: freebsd-usb@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3AABE106566B for ; Sat, 3 Sep 2011 20:00:21 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id EF5C68FC18 for ; Sat, 3 Sep 2011 20:00:20 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p83K0KUc021230 for ; Sat, 3 Sep 2011 20:00:20 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p83K0KFQ021229; Sat, 3 Sep 2011 20:00:20 GMT (envelope-from gnats) Resent-Date: Sat, 3 Sep 2011 20:00:20 GMT Resent-Message-Id: <201109032000.p83K0KFQ021229@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-usb@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Poul-Henning Kamp Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5BAEF106566C for ; Sat, 3 Sep 2011 19:55:23 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) by mx1.freebsd.org (Postfix) with ESMTP id 1AB738FC18 for ; Sat, 3 Sep 2011 19:55:22 +0000 (UTC) Received: from critter.freebsd.dk (critter-phk.freebsd.dk [192.168.48.2]) by phk.freebsd.dk (Postfix) with ESMTP id 6C48A5E25 for ; Sat, 3 Sep 2011 19:55:21 +0000 (UTC) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.14.5/8.14.5) with ESMTP id p83JtL1f009110 for ; Sat, 3 Sep 2011 19:55:21 GMT (envelope-from phk@critter.freebsd.dk) Received: (from phk@localhost) by critter.freebsd.dk (8.14.5/8.14.5/Submit) id p83JtLaK009109; Sat, 3 Sep 2011 19:55:21 GMT (envelope-from phk) Message-Id: <201109031955.p83JtLaK009109@critter.freebsd.dk> Date: Sat, 3 Sep 2011 19:55:21 GMT From: Poul-Henning Kamp To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: usb/160436: ucom wedges machine on parity error ? X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Poul-Henning Kamp List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Sep 2011 20:00:21 -0000 >Number: 160436 >Category: usb >Synopsis: ucom wedges machine on parity error ? >Confidential: no >Severity: serious >Priority: low >Responsible: freebsd-usb >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Sep 03 20:00:20 UTC 2011 >Closed-Date: >Last-Modified: >Originator: Poul-Henning Kamp >Release: FreeBSD 8.2-STABLE i386 >Organization: >Environment: FreeBSD shus.dc.freebsd.dk 8.2-STABLE FreeBSD 8.2-STABLE #0: Wed Aug 31 08:43:34 UTC 2011 root@hex-drift.freebsd.dk:/freebsd/obj/nanobsd.shus/freebsd/src/sys/NET4801 i386 Soekris NET4801 >Description: I'm running Soekris NET4801 doing data collection, it has been running stable for years. Recently I added a USB-serial port running in raw mode at 300/7/EVEN The machine started freezing hard and recovered only when the watchdog kicked in. When frozen, there is no serial console reaction, no packet traffic and no signs of a panic message. I tried two different USB-serial dongles, one UPLCOM and one UFTDI, apart from a possibly slightly different frequency, no difference. Disabling the software on the USB serial port, made the freezes go away. I have now moved the parity check into software, running the port as 300/8/NONE instead, and the problem has not been seen since. Has anybody ever tested a parity error on a USB serial port ? >How-To-Repeat: >Fix: >Release-Note: >Audit-Trail: >Unformatted: