summaryrefslogtreecommitdiff
path: root/firmware/usbstack/usb_core.c
AgeCommit message (Collapse)Author
2014-02-10Coding style fix for bde5394Marcin Bukat
Change-Id: I6e9ba6a2570915191cf5b66f58ed9ddb1959b6cc
2014-02-09Return a valid USB string descriptor for index 0xEE.Frank Gevaerts
Windows will try to retrieve such a descriptor on first connect. If the device returns STALL or a regular string descriptor (i.e. not one that follows the Microsoft OS Descriptor spec), things will continue normally. Unfortunately some of our low-level USB drivers have issues with STALL so any other valid descriptor is the next best solution. Change-Id: I59eb09eea157e4e14bec0197a898be378a5559f2 Reviewed-on: http://gerrit.rockbox.org/680 Reviewed-by: Frank Gevaerts <frank@gevaerts.be> Tested: Frank Gevaerts <frank@gevaerts.be>
2014-01-05Make sure usb class driver disconnect() functions are called properly.Frank Gevaerts
disconnect() needs to be called exactly once per call to init_connection(). In case of bus resets, disconnect() was not called, which led to leaking alloc_maximum() allocated buflib handles, which led to buflib running out of memory to allocate. Change-Id: I03025da578dc54e48b6de6bd3e3f40feae7220a6
2013-07-24usb stack: add more verbose debug logf()sMarcin Bukat
Change-Id: I087aefd2854978813c7e4ed7ef7da400f3692e39
2013-07-24usb_core: rework handling of clear featureAmaury Pouly
Change-Id: Icb1e973aa5fd8520eff0796aa8164e0a988d9107
2013-06-24imx233: fix ocotop/debug and usb-core for stmp3600Amaury Pouly
Currently we don't know where the serial number is stored on the stmp3600. It is probably using the laser fuses but this needs to be investigated Change-Id: I1ac25e38b8f65635abb68788ceb65df0a740dabd
2013-06-16imx233: rewrite ocotp using new register headersAmaury Pouly
Change-Id: I3c622119a1e296ec6b3f35f27e81b5118ab7f6cc
2012-12-07usb: add support for hardware handled SET ADDR/CONFIGAmaury Pouly
Some USB controllers like the one of the Rockchip 27xx handle some requests in pure hardware. This is especially a problem for two of them: - SET ADDR which is used by our core to track the DEFAULT/ADDRESS state and is required for the drivers to work properly - SET CONFIG which is used by our core to initialise the drivers by calling init_connection() In these cases we need a way to notify the core that such requests happened. We do this by exporting two functions which directly notify the core about these requests and perform the necessary init steps required without doing the actual USB transfers. Special care is needed because these functions could be called from an interrupt handler. For this reason we still use the usb_queue and introduce new IDs so that they are processed in order and safely. No functional change is intended, both in the usbstack and on targets without such quirks. Change-Id: Ie42feffd4584e88bf37cff018b627f333dca1140
2012-05-31Fill USB serial number descriptor on imx233 targets.Amaury Pouly
Compute a serial number using the ocotp OPS bits like the OF. Also add a comment about the first character of serial number being a indicator of the enabled interfaces. Change-Id: I9b90aed4e3b803f12fec003c9bc8ee8a046f4e42
2012-05-07missing constRafaël Carré
2012-01-04Reorganise USB initialisation to not depend on a specific enumeration ↵Frank Gevaerts
sequence, by Bartosz Fabianowski, with minor tweaks by Michael Sevakis (FS#12497) FreeBSD apparently sends a SET_ADDRESS first, which confused our code. This patch fixes that, and also simplifies the connection handling a bit. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31582 a1c6a512-1295-4272-9138-f99709370657
2011-12-31usb_core: Fix typo in commentMichael Sparmann
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31482 a1c6a512-1295-4272-9138-f99709370657
2011-05-08Fix tabs in .c and .h files in firmware/ Bertrik Sikken
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29832 a1c6a512-1295-4272-9138-f99709370657
2011-01-17Add a higher level USB detection that prevents fraudulent bus resets from ↵Michael Sevakis
causing USB mode to be entered. Enable for SA9200 only at this time. Also, for SA9200, use the bus power GPIO rather than the 'connector inserted' GPIO to detect the cable. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29068 a1c6a512-1295-4272-9138-f99709370657
2010-09-20usb: remove unused variable and correctly stall on unhandled control requestsAmaury Pouly
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28121 a1c6a512-1295-4272-9138-f99709370657
2010-09-06Fix set_serial_descriptor() for targets with as3543Rafaël Carré
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28013 a1c6a512-1295-4272-9138-f99709370657
2010-06-05New USB charging system, part 2 - "Force" charging modeTorne Wuff
Enable support for the "force" mode of USB charging. This should work on Gigabeat S and Nano2g (and any other future target which has a RB usb stack and supports charging) - if a host connection is not detected within 10 seconds of USB insertion, assume that the connected device is an AC charger and charge anyway, if the user has specified "force" as the mode. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26594 a1c6a512-1295-4272-9138-f99709370657
2010-06-05New USB charging system, part 1 - API rework and user-visible setting updateTorne Wuff
1) "Charge during USB connection" option is now tristate: off/on/force. Currently "force" behaves just like "on", but in future it will allow charging even when it was not possible to positively identify a charger. 2) The H300 code has been adjusted to use the new system but there should be no functional differences, it already had the USB charging option and its USB/charging support is hardware controlled. 3) The Gigabeat S code has been adjusted to use the new system: the player now has the USB charging option, which wasn't previously available. The player will only charge at full speed when allowed to do so by a working USB host, so USB AC adapters won't work very well; however, they didn't work before either, so this is not a change in functionality. 4) The iPod Nano 2G code has been adjusted to use the new system: it already had the USB charging option. Using a USB AC adapter won't charge at full speed any more (it did before) - the old implementation was equivalent to the not-yet-implemented "force" option in the new system. No other target should be affected. Support for the "force" mode and support for at least some other iPod models will come in a future commit :) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26570 a1c6a512-1295-4272-9138-f99709370657
2010-04-13Enforce the 80-char limit to make everyone happy.Amaury Pouly
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25619 a1c6a512-1295-4272-9138-f99709370657
2010-04-13- Forget a cosmetic change.Amaury Pouly
- Interface number is in lower half of wIndex for interface control requests. Upper half is reserved and used in other protocols. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25618 a1c6a512-1295-4272-9138-f99709370657
2010-04-13Attempt to have a consistent coding convention in usb_core.cAmaury Pouly
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25617 a1c6a512-1295-4272-9138-f99709370657
2010-03-27Remove unnecessary (and incorrect) acks after stalling the control endpointFrank Gevaerts
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25359 a1c6a512-1295-4272-9138-f99709370657
2010-03-08- Fix the control_handler selection in usb_core when a request in sent to an ↵Amaury Pouly
endpoint (use endpoint dir and not EP_CONTROL !) - Only interpret standard endpoint requests (previous code didn't check the request type) and pass all others to usb drivers. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25069 a1c6a512-1295-4272-9138-f99709370657
2009-11-15use the EP_DIR() macro to go from USB_DIR_* to a 0 or 1 valueFrank Gevaerts
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23640 a1c6a512-1295-4272-9138-f99709370657
2009-11-15Don't use the same completion_event for both directions. This could cause ↵Frank Gevaerts
problems on USB controllers that have IN and OUT endpoints with the same endpoint number (such as the arc controller) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23639 a1c6a512-1295-4272-9138-f99709370657
2009-11-03Comment out LOGF_ENABLE defines everywhere, replace evil commentsJeffrey Goode
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23497 a1c6a512-1295-4272-9138-f99709370657
2009-10-19Change control handling to start expecting host packets before sending data ↵Frank Gevaerts
to the host. This makes the handling less timing sensitive on some controllers git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23263 a1c6a512-1295-4272-9138-f99709370657
2009-10-13USB: Use explicit casting when setting wTotalLength field in descriptorTomer Shalev
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23157 a1c6a512-1295-4272-9138-f99709370657
2009-09-30Commit "FS#10468 - USB HID: Show keypad mode on screen"Tomer Shalev
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22852 a1c6a512-1295-4272-9138-f99709370657
2009-07-23Remove USB storage defines from USB coreMaurus Cuelenaere
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22018 a1c6a512-1295-4272-9138-f99709370657
2009-05-24always call the class driver init function. This is needed because they are ↵Frank Gevaerts
called before the usb_core_enable_driver() calls, so depending on enabled status breaks things git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21069 a1c6a512-1295-4272-9138-f99709370657
2009-05-23Reorganise USB stack defines. Now config.h decides which class drivers get ↵Frank Gevaerts
enabled instead of usb_core.h Also enable HID, and use that as the dummy class instead of charging-only for controllers that have working interrupt transfers. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21053 a1c6a512-1295-4272-9138-f99709370657
2009-05-23Fix #ifdef nesting to allow USB_HID to be built without USB_CHARGING_ONLY ↵Frank Gevaerts
(FS#10236 by Tomer Shalev) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21052 a1c6a512-1295-4272-9138-f99709370657
2009-05-16Add working USB HID driver, by Tomer Shalev (part of his GSoC work).Frank Gevaerts
This needs support for usb interrupt transfers, so there are some changes in various USB drivers as well (only usb-drv-arc supports it at this point, others won't have working HID yet). HID is disabled for now, as the apps/ part is not included yet. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20962 a1c6a512-1295-4272-9138-f99709370657
2009-04-20Disable usage of USB serial descriptor when no unique one is availableMaurus Cuelenaere
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20761 a1c6a512-1295-4272-9138-f99709370657
2009-04-19Add preliminary HID driver. It doesn't do anything yet, but that should ↵Frank Gevaerts
change soon (FS#10116 by Tomer Shalev) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20750 a1c6a512-1295-4272-9138-f99709370657
2009-04-19reorganise usb_core.c a bit, to make the code more readable and more ↵Frank Gevaerts
maintainable (FS#10150 by Tomer Shalev)) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20748 a1c6a512-1295-4272-9138-f99709370657
2009-04-18USB related Cosmetics, whitespace and readability fixes (FS#10147 by Tomer ↵Frank Gevaerts
Shalev) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20737 a1c6a512-1295-4272-9138-f99709370657
2009-04-18Allow class drivers to reuse the core data buffer for control transfers. ↵Frank Gevaerts
This doesn't make much difference right now, but it should keep HID memory usage lower (once HID is ready) (FS#10146 by Tomer Shalev) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20735 a1c6a512-1295-4272-9138-f99709370657
2009-04-11Fix unintentional usage of relatively unknown C features (FS#10119, found by ↵Frank Gevaerts
Tomer Shalev) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20685 a1c6a512-1295-4272-9138-f99709370657
2009-03-23Correct Björn's name in various file headers.Nicolas Pennequin
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20491 a1c6a512-1295-4272-9138-f99709370657
2009-01-19USB detection changes. c200/e200: Consider USB to be powered when charger is ↵Michael Sevakis
plugged but detect USB connection by bus reset. When received, disconnect and restart the driver fully enabled. imx31: Fix hack used to make initial connect succeeded-- set PHY type before initial reset. General: Move some target code out of usb-drv-arc.c and implement it in respective usb sources and CPU headers so things stay clean. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19797 a1c6a512-1295-4272-9138-f99709370657
2009-01-13USB retweaking: Take out the USB_REQUEST/RELEASE_DISK scheme and simply ask ↵Michael Sevakis
the USB core whether or not any drivers require exclusive access at the moment of connect. Doing anthing else just produces nasty effects on Windows because it expects some communication just for enabling the PHY and not allowing it to mount volumes if a thread doesn't ack causes annoying error message boxes. Make behavior of each USB type identical from the system perspective. Some miscellaneous changes (simplify, ata->storage naming, define only used USB_* enums values were possible). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19762 a1c6a512-1295-4272-9138-f99709370657
2008-12-13Add a disconnect handler for usb storage. It doesn't do anything yet, but it ↵Frank Gevaerts
will apparently be needed to reset the audio buffer git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19418 a1c6a512-1295-4272-9138-f99709370657
2008-11-30Replace USE_HIGH_SPEED with USB_NO_HIGH_SPEED, as high speed support is the ↵Frank Gevaerts
normal case git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19274 a1c6a512-1295-4272-9138-f99709370657
2008-11-30Move tcc77x/usb-tcc77x.c to usb-tcc.c as it is more general than just tcc77x ↵Frank Gevaerts
(even usb-tcc is too specific, but I don't know anything better) Add #if0ed USB defines to config-cowond2.h, so experimenting with USB is easy Add dummy set_serial_descriptor() implementation to usb_core.c. This one doesn't generate a unique serial, so it must never be used for non-testing purposes. When usaed, a compiler warning will be generated git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19273 a1c6a512-1295-4272-9138-f99709370657
2008-11-03Add ramdisk storage driver. It will be useful for developing multi-driver ↵Frank Gevaerts
storage git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18993 a1c6a512-1295-4272-9138-f99709370657
2008-11-01Apply FS#9500. This adds a storage_*() abstraction to replace ata_*(). To do ↵Frank Gevaerts
that, it also introduces sd_*, nand_*, and mmc_*. This should be a good first step to allow multi-driver targets, like the Elio (ATA/SD), or the D2 (NAND/SD). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18960 a1c6a512-1295-4272-9138-f99709370657
2008-10-31Abstract the PortalPlayer AS3514 handling with an "ascodec" API - inspired ↵Dave Chapman
by the wmcodec API used with the Wolfson codecs. The intention is to implement this API for the AS3525 and then share code with the Sansa V2 ports. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18940 a1c6a512-1295-4272-9138-f99709370657
2008-10-03disable logf againFrank Gevaerts
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18704 a1c6a512-1295-4272-9138-f99709370657