path: root/firmware/usb.c
AgeCommit message (Collapse)AuthorFilesLines
2020-12-24USB: Reset poweroff timer for all USB eventsSolomon Peachy1-0/+3
Without this, if a device is left plugged in and idle, unplugging it will trigger an immediate shutdown. Change-Id: I65caaa0c1473562ec5d0bb776b01d4d222d69965
2020-11-17usb: increase the stack size.Solomon Peachy1-1/+1
It's not large enough on some targets. (this will be revisited when the USB insertion prompt stuff is moved out of the USB helper and over to the main thread) Change-Id: Iefed2cdf2fbb4ce92569fc5cacbdb479b7d24e61
2020-11-16FS13257: Fix inconsistent defaults in the USB mode selectionSolomon Peachy1-3/+4
Change-Id: I44894d13f070313ad326ce68018556573e35aad9
2020-11-13ibasso: Hopefully hack usb into building again.Solomon Peachy1-7/+7
Change-Id: I6f369d60319704ab4d2c18b80ba6e78902630790
2020-11-13usb: Add ability to prompt user about what to do upon usb insertionSolomon Peachy1-16/+64
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-02FuzePlus USB+screen dump overflows usbstackWilliam Wilgus1-1/+4
Bump USB stack by 128 bytes adds USB_EXTRA_STACK Change-Id: I12839edbe889c878482081cf59fc6540384673ac
2020-07-24[4/4] Remove HAVE_LCD_BITMAP, as it's now the only choice.Solomon Peachy1-6/+0
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[1/4] Remove SH support and all archos targetsSolomon Peachy1-1/+1
This removes all code specific to SH targets Change-Id: I7980523785d2596e65c06430f4638eec74a06061
2018-07-28Add cleaned-up xDuoo X3 supportSolomon Peachy1-1/+2
Cleaned up, rebased, and forward-ported from the xvortex fork. (original credit to Change-Id: Ibcc023a0271ea81e901450a88317708c2683236d Signed-off-by: Solomon Peachy <>
2017-10-26Fix a few missed things in 16454efc (and hopefully clear the red).Michael Sevakis1-0/+3
Change-Id: I2ce88e4c41e6e08efbfbdf261122318dfb0f8b0f
2017-03-12Do some housekeeping with fat.h and SECTOR_SIZEMichael Sevakis1-1/+0
Many includes of fat.h are pointless. Some includes are just for SECTOR_SIZE. Add a file 'firmware/include/fs_defines.h' for that and to define tuneable values that were scattered amongst various headers. Remove some local definitions of SECTOR_SIZE since they have to be in agreement with the rest of the fs code anyway. (We'll see what's in fact pointless in a moment ;) Change-Id: I9ba183bf58bd87f5c45eba7bd675c7e2c1c18ed5
2015-01-08usb: finally get rid of USE_ROCKBOX_USB in Sansa bootloader, use bootloader usbAmaury Pouly1-3/+1
For some reason, the bootloader and config files didn't define HAVE_BOOTLOADER_USB_MODE, also remove the special cases in usb.c which they implied. Change-Id: I68c29be7d03627e64cac4ff7678e0c211e087a8c
2015-01-08usb: make usb_release_exclusive_storage privateAmaury Pouly1-0/+2
Change-Id: I0383760b7d8e67cc99bbe4e4979bca92ef436c8d Reviewed-on: Reviewed-by: Amaury Pouly <>
2015-01-08Clarify usb_powered() and fix some code.Amaury Pouly1-1/+1
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: Reviewed-by: Amaury Pouly <>
2015-01-08Get rid of USE_ROCKBOX_USBAmaury Pouly1-15/+4
Except for unfinished or experimental ports, it isthe case that USE_ROCKBOX_USB and HAVE_USBSTACK are both defined or both undefined. Furthermore, it is a leftover of some early developments on the USB stack and doesn't make sense anymore. Change-Id: Ic87a865b6bb4c7c9a8d45d1f0bb0f2fb536b8cad Reviewed-on: Reviewed-by: Amaury Pouly <>
2013-05-22USB: Detect charging-only mode upon cable insert, not host detect.Michael Sevakis1-5/+15
Letting go of the button before the host is detected allows storage mode to be entered even though a button was down when plugging. Sometimes the host would try several times and the button would have to be held down for several seconds to avoid a storage connection. The adjustment wasn't made when switching to setup request host detection. Change-Id: Iab3bced5bfb1478d4d9a7baab2a2a1144afaf437
2013-03-24Remove redundant assigment of variable to itselfBertrik Sikken1-1/+1
Change-Id: Ibecd8c869280a55a0716e631f44ab556f7dbd8b5
2012-12-07usb: add support for hardware handled SET ADDR/CONFIGAmaury Pouly1-0/+11
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-20Undo f695681 (r30433). USB hardware must be initialized first.Jens Arnold1-2/+5
This fixes flash/ MMC access on the Ondios when booting from ROM. Add a comment what to pay attention for in the target specific usb_init_device().
2012-01-07usb: fix another typoAmaury Pouly1-1/+1
git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2012-01-07usb: fix typo in DEBUGFAmaury Pouly1-1/+1
git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2012-01-04Move some variable declarations to inside #ifdef USB_FULL_INIT, to avoid ↵Frank Gevaerts1-3/+3
warnings for bootloaders that don't have the full USB state machine git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2012-01-04Reorganise USB initialisation to not depend on a specific enumeration ↵Frank Gevaerts1-77/+81
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:// a1c6a512-1295-4272-9138-f99709370657
2011-12-31fix r31502: USBOTG_AS3525v2 doesn't exist anymoreRafaël Carré1-3/+2
git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2011-12-31usb-target.h: removeRafaël Carré1-1/+0
git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2011-12-15Simplify and neaten-up usb.c a bit. USB_INSERTED and USB_EXTRACTED are ↵Michael Sevakis1-87/+64
always used as events to indicate cable state. USB_HOSTED is posted to indicated that a host was detected. git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2011-12-14Fix the real issue with AMS bootloader USB mode. A call to usb_enable was ↵Michael Sevakis1-6/+15
missing in usb.c when using the USB stack and USB_DETECT_BY_CORE was not enabled. Try to do it in a clean-ish way. git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2011-11-20Fix typo in commentRafaël Carré1-1/+1
git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2011-11-17Simulate usb plugging on the sim better using sim_tasks.Thomas Martitz1-5/+3
Now all threads need to ack the connection like on real target, dircache is unloaded and playback stops accordingly. git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2011-10-27usb: add forgotten break in usb switch, this could lead to unwanted code ↵Amaury Pouly1-1/+1
being execute like USB_QUIT to be sent on hotswap ! git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2011-10-08usb: only declare usb_mmc_countdown on target which don't use the usb stackAmaury Pouly1-1/+1
git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2011-09-14Remove obsolete USB_DETECT_BY_DRV define throughout.Michael Sevakis1-16/+11
git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2011-09-05usb: make sure device init happens *after* queue/thread creationAmaury Pouly1-2/+2
Albeit unlikely, usb_init_devide() could cause de transfer completion before queue creation and the core would push onto a uninitialized queue ! git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2011-08-15Add a 100ms delay before calling disk_mount_all(). Some players (especially ↵Frank Gevaerts1-0/+1
some gigabeat Fs) seem to need a delay after disabling USB if we want disk access to work. git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2011-05-16The gigabeat S needs special casing so that you can still hold vol down to ↵Michael Giacomelli1-1/+1
access its firmware partition. Additionally, the same logic should apply to firewire on the iPods. git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2011-05-16Enter USB charging mode on devices that support it if any key is held down ↵Michael Giacomelli1-5/+1
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:// a1c6a512-1295-4272-9138-f99709370657
2011-03-05Change the thread api a bit.Thomas Martitz1-2/+2
* Remove THREAD_ID_CURRENT macro in favor of a thread_self() function, this allows thread functions to be simpler. * thread_self_entry() shortcut for kernel.c. git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2011-02-27iPod Classic CE-ATA Support (Part 2 of 4: Remove on-stack sector buffers, ↵Michael Sparmann1-1/+1
and replace them with a single statically allocated sector buffer that's arbitrated amongst users) git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2011-02-14All kernel objects in code shared amongs targets (core, plugins, codecs) ↵Michael Sevakis1-1/+1
should be declared SHAREDBSS_ATTR as any core could potentially touch them even though they seem only to involve threads on one core. The exception is target code for particular CPUs where proper allocation is fixed. playlist.c was a little odd too-- use one mutex for the current playlist and a separate one for created playlists (still pondering the necessity of more than one). git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2011-01-29USB: Thread must remember that a host has been detected since the POWERED ↵Michael Sevakis1-2/+14
state is ambiguous when waiting for host. Storage access is not yet actually exclusive if not USB_INSERTED. usb_start_monitoring seems better posting USB_UNPOWERED only if USB_EXTRACTED, interpreting POWERED/INSERTED as POWERED. git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2011-01-28Big oops. Should be broadcasting SYS_USB_DISCONNECTED _after_ remouting disks.Michael Sevakis1-2/+3
git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2011-01-18Fix colors from r29084. Had some things in the wrong preprocessor blocks.Michael Sevakis1-40/+40
git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2011-01-18Try to get some control over #ifdef hell in usb.c by refactoring and inline ↵Michael Sevakis1-272/+325
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:// a1c6a512-1295-4272-9138-f99709370657
2011-01-17One change in r29068 wasn't right. Clarify comments on why it's the way it ↵Michael Sevakis1-4/+5
is. :) git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2011-01-17Add a higher level USB detection that prevents fraudulent bus resets from ↵Michael Sevakis1-7/+12
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:// a1c6a512-1295-4272-9138-f99709370657
2011-01-15Bootloader USB mode for PP502x. Enable only on GoGear SA9200 for the time ↵Michael Sevakis1-1/+1
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:// a1c6a512-1295-4272-9138-f99709370657
2010-11-28Accept FS#11774 by Michael Hohmuth (with some own modifications to #ifdef ↵Frank Gevaerts1-0/+2
conditions) Unmount all filesystems before connecting USB. This ensures that all filehandles are closed, which avoids possible filesystem corruption git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2010-10-25Really fix yellow: Rename BMP_LINESIZE and BMP_BPP to get rid of the macro ↵Michael Sparmann1-1/+1
name collision git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2010-10-25Fix screendump on iPod Nano 2G by increasing the usb thread stack size and ↵Michael Sparmann1-3/+2
reducing the stack usage of FAT and storage functions git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2010-10-24AMSv2: fix bootloader build with USB enabledRafaël Carré1-1/+2
git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657