Commit graph

75 commits

Author SHA1 Message Date
Aidan MacDonald
7e0492444c usb: remove "Ask" USB Mode (FS#13317)
USB ask mode is basically a footgun: it can't work on native targets
and doesn't work reliably on hosted ones, and it continually produces
a slow trickle of problems. FS#13317 gives a rundown of the issues.
Removing the setting seems like the best solution for now, since a fix
would be pretty involved.

This partially reverts 60f581e8f5. The USB Mode setting is left in
place so the option can be added back later in a non-buggy way.

Change-Id: Ie01b28dd2ed95a31b509a7834d85bac8eb866098
2022-06-21 18:11:53 -04:00
Aidan MacDonald
b69d43c247 usb: give USB transfer completion events two data pointers
Change-Id: I036cc7f02c2f86a364d2dba59493a6aa893f2c16
2021-10-16 21:14:42 +01:00
Solomon Peachy
9c68c69cf0 FS13257: Fix inconsistent defaults in the USB mode selection
Change-Id: I44894d13f070313ad326ce68018556573e35aad9
2020-11-16 17:11:38 +00:00
Solomon Peachy
60f581e8f5 usb: Add ability to prompt user about what to do upon usb insertion
v3: Add in config option
 v4: Bugfixes
 v5: Force a redraw upon exiting
 v6: keypress-in-chargeonly mode enables mass storage (and vice versa)
 v7: Fix bootloader builds
 v8: Update manual, and have bootloader respect keypresses
 v9: Change default to mass storage (ie no change in behavior)

 todo:
  * test-build dx50/dx90
  * Switch from yes/no to proper menu?
  * prevent WPS progress bar from drawing over us

Change-Id: I82e0ccb08497b7a5aa756ce77f1332ee963703a7

...

Change-Id: I7946cf240b18a4fa8ace5e25e1eb6e97b8b12d7c
2020-11-13 16:44:01 -05:00
Solomon Peachy
658026e626 [4/4] Remove HAVE_LCD_BITMAP, as it's now the only choice.
Note:  I left behind lcd_bitmap in features.txt, because removing it
would require considerable work in the manual and the translations.

Change-Id: Ia8ca7761f610d9332a0d22a7d189775fb15ec88a
2020-07-24 21:20:13 +00:00
Solomon Peachy
092c340a20 [1/4] Remove SH support and all archos targets
This removes all code specific to SH targets

Change-Id: I7980523785d2596e65c06430f4638eec74a06061
2020-07-24 21:20:13 +00:00
Amaury Pouly
278a76b3a6 add some documentation in usb.h and usb_drv.h
Change-Id: Icd39ee5c017fc219144b33ef96b0df85c5d430da
2020-07-09 14:09:10 +00:00
Amaury Pouly
3aebdfa642 usb: make usb_release_exclusive_storage private
Change-Id: I0383760b7d8e67cc99bbe4e4979bca92ef436c8d
Reviewed-on: http://gerrit.rockbox.org/1098
Reviewed-by: Amaury Pouly <amaury.pouly@gmail.com>
2015-01-08 16:45:41 +01:00
Amaury Pouly
dc127f213c Clarify usb_powered() and fix some code.
Either by mistake or because its meaning changed, usb_powered() doesn't mean
what the name suggest, so clarify its meaning by renaming it to usb_powered_only.
So use of usb_powered() are replaced by usb_inserted() when it makes more sense.

Change-Id: I112887e2d8560e84587bee5f55c826dde8c806d8
Reviewed-on: http://gerrit.rockbox.org/1097
Reviewed-by: Amaury Pouly <amaury.pouly@gmail.com>
2015-01-08 16:45:32 +01:00
Amaury Pouly
1ab91550e6 usb: document usb states, powering and detection
Change-Id: Ia3b7d6c6294bfb9272355c3f28a994dd0e83cbce
Reviewed-on: http://gerrit.rockbox.org/1096
Reviewed-by: Amaury Pouly <amaury.pouly@gmail.com>
2015-01-08 16:45:22 +01:00
Amaury Pouly
ae37d1944f usb: document usb_status_event and #ifdef it with USB_STATUS_BY_EVENT
Change-Id: I62cdb8ad71a598279fe99cc91d87eafda26cbbc7
Reviewed-on: http://gerrit.rockbox.org/1095
Reviewed-by: Amaury Pouly <amaury.pouly@gmail.com>
2015-01-08 16:45:11 +01:00
Amaury Pouly
268114ee66 usb: move usb charging function prototype from usb_core.h to usb.h
Change-Id: Id29c60d3aa26f8badca6c38c1cbb2e5a39c554dc
Reviewed-on: http://gerrit.rockbox.org/1094
Reviewed-by: Amaury Pouly <amaury.pouly@gmail.com>
2015-01-08 16:44:55 +01:00
Amaury Pouly
775ab07d5e usb: add support for hardware handled SET ADDR/CONFIG
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-12-07 13:37:26 +01:00
Frank Gevaerts
4fcffcbdf3 Reorganise USB initialisation to not depend on a specific enumeration 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
2012-01-04 21:55:09 +00:00
Rafaël Carré
bce42fdc31 usb_init_device(): move prototype to usb.h
Get rid of some usb-target.h files

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31487 a1c6a512-1295-4272-9138-f99709370657
2011-12-31 18:43:41 +00:00
Boris Gjenero
fdc29d0ea4 Add more INIT_ATTR and add config.h includes to header files with INIT_ATTR.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31370 a1c6a512-1295-4272-9138-f99709370657
2011-12-19 20:12:52 +00:00
Michael Sevakis
47bade1437 Simplify and neaten-up usb.c a bit. USB_INSERTED and USB_EXTRACTED are always used as events to indicate cable state. USB_HOSTED is posted to indicated that a host was detected.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31263 a1c6a512-1295-4272-9138-f99709370657
2011-12-15 00:14:36 +00:00
Boris Gjenero
8e6030c822 FS#12378 : Remove various unused code, and comment out some unused code and data for reference or future use.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31256 a1c6a512-1295-4272-9138-f99709370657
2011-12-14 21:45:25 +00:00
Michael Sevakis
c222f38c03 Remove obsolete USB_DETECT_BY_DRV define throughout.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30549 a1c6a512-1295-4272-9138-f99709370657
2011-09-14 16:42:43 +00:00
Frank Gevaerts
544a52d9eb Add "USB Hide Internal Drive" option for multidrive devices with software usb.
This option allows accessing the card slot from "dumb" USB hosts like some car
audio systems that do not handle multi-LUN devices.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30489 a1c6a512-1295-4272-9138-f99709370657
2011-09-09 16:15:35 +00:00
Michael Giacomelli
e8c79d65e1 The gigabeat S needs special casing so that you can still hold vol down to access its firmware partition. Additionally, the same logic should apply to firewire on the iPods.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29890 a1c6a512-1295-4272-9138-f99709370657
2011-05-16 21:10:31 +00:00
Michael Giacomelli
84b4c46d74 Enter USB charging mode on devices that support it if any key is held down during USB insert (except on Archos where certain keys need to be avoided and players like the iRiver H1x0 which do not charge over USB and the iAudios/AMSv2 which do not yet support USB fully). Update the manual to explain the new behavior.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29889 a1c6a512-1295-4272-9138-f99709370657
2011-05-16 20:27:14 +00:00
Michael Sevakis
453550a687 Try to get some control over #ifdef hell in usb.c by refactoring and inline function use. SYS_USB_DISCONNECTED_ACK hasn't been doing anything useful for the USB thread; remove it. USB thread simply ignores that value. Observe only valid usb_state transitions.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29084 a1c6a512-1295-4272-9138-f99709370657
2011-01-18 14:10:06 +00:00
Michael Sevakis
05f6f3419a Add a higher level USB detection that prevents fraudulent bus resets from 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
2011-01-17 12:24:41 +00:00
Michael Sevakis
3a1127785b Bootloader USB mode for PP502x. Enable only on GoGear SA9200 for the time being. Add HAVE_BOOTLOADER_USB_MODE to config if BOOTLOADER is defined to enable it. Clean up some kernel stuff a little to support it. Mess up a bunch of other stuff (hopefully not too badly).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29053 a1c6a512-1295-4272-9138-f99709370657
2011-01-15 08:19:30 +00:00
Szymon Dziok
057806f67a HDD6330: Try to adapt the keys for the new touchpad code, remove the non existing buttons, enable morse input.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28306 a1c6a512-1295-4272-9138-f99709370657
2010-10-18 19:30:54 +00:00
Torne Wuff
2eb0142587 New USB charging system, part 2 - "Force" charging mode
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-05 20:43:30 +00:00
Torne Wuff
991e92fd3d New USB charging system, part 1 - API rework and user-visible setting update
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-06-05 10:05:27 +00:00
Thomas Martitz
f8edc32589 FS#10756 - Free unused init code
Introduce a new .init section for initialisation code, so that it can be copied to an area which is later overwritten before calling. The stack/bss can then overwrite that code, effectively freeing the code size that the initialisation routines need. Gives a few kB ram usage back.
Only implemented for PP and as3525 so far. More targets could be added, as well as more functions.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25013 a1c6a512-1295-4272-9138-f99709370657
2010-03-03 23:20:32 +00:00
Frank Gevaerts
553626a958 Add initial Packard Bell Vibe 500 port, by Szymon Dziok
Author: Szymon Dziok 
Flyspray: FS#10912


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24276 a1c6a512-1295-4272-9138-f99709370657
2010-01-18 19:05:20 +00:00
Mark Arigo
6908cc5235 Merry Christmas Gogear HDD6330 owners! This is the start of the HDD6330 port. At the moment, it's essentially a copy of the HDD1630 port with a minimal LCD driver. The touchpad doesn't work as expected, but you can still kind of navigate and listen to music/radio.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24112 a1c6a512-1295-4272-9138-f99709370657
2009-12-25 04:05:01 +00:00
Maurus Cuelenaere
3ee23bab61 Onda VX747: add USBPOWER_BUTTON and USBPOWER_BTN_IGNORE
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24072 a1c6a512-1295-4272-9138-f99709370657
2009-12-18 12:29:56 +00:00
Tomer Shalev
47ddbaa47b Cowon D2: Rename COWOND2_PAD -> COWON_D2_PAD to match macro used in manual, and
to target naming conventions in general


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24010 a1c6a512-1295-4272-9138-f99709370657
2009-12-15 20:51:41 +00:00
Karl Kurbjun
02385cb5b0 M:Robe 500/M66591 USB improvements: Interrupts now work, a bug in odd-length transfers has been fixed. Buffers that are not initially short aligned are also now supported. Enable USB HID mouse mode.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23483 a1c6a512-1295-4272-9138-f99709370657
2009-11-02 04:37:57 +00:00
Tomer Shalev
83d24f89df FS#10704 - Make a configuration option to disable USB HID
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23322 a1c6a512-1295-4272-9138-f99709370657
2009-10-23 13:29:19 +00:00
Rob Purchase
9ce9cfc0a9 D2 should have HAVE_USB_POWER defined.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23298 a1c6a512-1295-4272-9138-f99709370657
2009-10-20 20:44:30 +00:00
Mark Arigo
a61196fd3a Philips SA9200: Working touchpad and button lights! Also, improvements to the keymap (still needs work).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21346 a1c6a512-1295-4272-9138-f99709370657
2009-06-19 03:23:38 +00:00
Mark Arigo
758bb3bc62 3 new ports: Samsung YH-820, YH-920, and YH-925. Mostly functional. Audio working on 820 & 925 (untested on the 920). No battery readings. No recording. No plugins. Keymap needs work.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21083 a1c6a512-1295-4272-9138-f99709370657
2009-05-25 21:10:45 +00:00
Frank Gevaerts
69a4117c1d Add working USB HID driver, by Tomer Shalev (part of his GSoC work).
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-05-16 15:30:09 +00:00
Frank Gevaerts
2a085f4477 Add preliminary HID driver. It doesn't do anything yet, but that should change soon (FS#10116 by Tomer Shalev)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20750 a1c6a512-1295-4272-9138-f99709370657
2009-04-19 21:17:18 +00:00
Frank Gevaerts
00b407b04f USB related Cosmetics, whitespace and readability fixes (FS#10147 by Tomer Shalev)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20737 a1c6a512-1295-4272-9138-f99709370657
2009-04-18 21:32:41 +00:00
Frank Gevaerts
463e20271b Fix some whitespace issues (including tabs that slipped in somehow) (FS#10144 by Tomer Shalev)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20731 a1c6a512-1295-4272-9138-f99709370657
2009-04-18 18:17:29 +00:00
Frank Gevaerts
871db6f5d9 Allow the user to leave MSC mode by pressing the USB POWER button (the one that's used to go to usb power mode on plugin) when the host OS hasn't locked the device.
This only works for devices that expose a removable device, so for now the gigabeat S is out of luck.
(slightly modified from FS#9993)


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20244 a1c6a512-1295-4272-9138-f99709370657
2009-03-08 18:45:19 +00:00
Frank Gevaerts
afedfcf44e Leave "usb mode" when all LUNs are ejected again
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20139 a1c6a512-1295-4272-9138-f99709370657
2009-02-28 15:16:54 +00:00
Michael Sevakis
da76a34694 Use bus reset detection for all ARC OTG devices. Remove conflict from LV24020LP driver with some GPIO-by-number macros for PP502x. Start monitoring for USB stack once all core threads and queues are created otherwise queues will likely be registered after USB acks. Putting PP502x system_reboot in IRAM (unmapped, uncached) memory seems to help it work more consistently. Hopefully I got all the PP USB connect handlers in the right spot in irq_handler. If device seems unresponsive to cable, check there first.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19819 a1c6a512-1295-4272-9138-f99709370657
2009-01-22 22:05:04 +00:00
Michael Sevakis
616c98b38f USB detection changes. c200/e200: Consider USB to be powered when charger is 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-19 13:41:25 +00:00
Michael Sevakis
e2a25592f8 Gigabeat S has no need for a USB tick. Put in a simple framework that allows USB monitoring by event. Also add a couple missed usb_enable calls when the connection is not for 'slave mode'.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19768 a1c6a512-1295-4272-9138-f99709370657
2009-01-14 07:01:49 +00:00
Michael Sevakis
6da8b4eb49 USB retweaking: Take out the USB_REQUEST/RELEASE_DISK scheme and simply ask 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
2009-01-13 16:27:35 +00:00
Michael Sevakis
5667682dd2 Gigabeat S: Implement charging and power control to charge from AC or USB. Hold MENU while plugging USB cable to charge from USB without connecting. Under Windows, plugging USB for charging only but not connecting still needs to be properly handled (driver popup issue) but it will charge when connected normally-- no issue under Linux. Some accomodating changes made to powermgmt.c will soon be made nicer.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19547 a1c6a512-1295-4272-9138-f99709370657
2008-12-21 18:10:36 +00:00
Dave Chapman
e25c1c6e43 Add more driver stubs to make the Fuze and e200v2 main builds compile; Correct the memory definition for the Fuze (8MB)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19090 a1c6a512-1295-4272-9138-f99709370657
2008-11-11 14:46:13 +00:00