- Status Closed
- Percent Complete
- Task Type Patches
- Category
- Assigned To No-one
- Operating System
- Severity Low
- Priority Very Low
- Reported Version
- Due in Version Undecided
-
Due Date
Undecided
- Votes
- Private
FS#2439 - USB power, but no USB mode
This patch lets you insert the USB cable on the ondio FM
and ondio SP without going into USB mode. This allows
for the Ondio to run without using batteries using USB-
power. To do this, hold the mode/menu button while
inserting the USB-cable.
It also fixes a bug where the USB screen would appear in
screendump mode, preventing the Ondio from doing
anything else. This is my first patch ever, i’m not very
familiar with the patch and diff tools and it’s also my first
modification to the archos software. Tested it on an
ondio FM, also in combination with the screendump
function.
What i did to create this patch, in the rockbox directory,
was typing:
cvs diff -u firmware apps > usb-power.diff
So i hope that works.
Loading...
Available keyboard shortcuts
- Alt + ⇧ Shift + l Login Dialog / Logout
- Alt + ⇧ Shift + a Add new task
- Alt + ⇧ Shift + m My searches
- Alt + ⇧ Shift + t focus taskid search
Tasklist
- o open selected task
- j move cursor down
- k move cursor up
Task Details
- n Next task
- p Previous task
- Alt + ⇧ Shift + e ↵ Enter Edit this task
- Alt + ⇧ Shift + w watch task
- Alt + ⇧ Shift + y Close Task
Task Editing
- Alt + ⇧ Shift + s save task
that is.. this one also fixes the bug when screendump is used,
not just with usb-power…
Please tell me more about this bug. Can you provide a
separate patch that fixes only the bug?
Of course. Here is how to reproduce the bug:
Start the ondio. Don't start playing music. Enable the
screendump mode. Insert the USB cable. Go to the filetree
screen, to the root of the filesystem. Press mode once, the
USB screen will appear and won't dissappear, unless you hold
the on button for ten seconds or so.
This is caused by the ask_resume function in tree.c using the
usb_detect function to check if a usb cable has been
inserted, then calling default_event_handler which in turn
calls the usb_screen function without entering usb-mode. It
can be fixed by using the usb-inserted function instead of the
usb_detect function here, so the usb screen will only appear
if the usb-mode is enabled.
The first patch including usb-power modified the default
event handler in misc.c to check when not to enter usb mode
(in this case, with usb power only and when in screendump
mode). I'm not sure which one is the approach to use. I
cannot see any complications with the modification in misc.c
(if done properly, it should not check usb_inserted() and not
do anything if this is not the case! Checking for speficic
situations is the only way there…) , while the first
modification might introduce other complications I am not
aware of, but seems a better way to fix. I'm sure one of the
developers would know this :)
(1) The bug is reproducable on the v1 recorder as well. In
addition to being a nasty deadlock situation, this also
prevents taking a screenshot of the resume request.
The check for usb at the beginning of ask_resume() is for
when resume is set to "yes", and usb is connected before
starting the box, the box shouldn't do resume first, then
notice the usb connection, but should go to usb mode right away.
However, the proposed fix doesn't work as intended because
of a race condition. usb_inserted() returns the internal
state of the usb thread, which takes several ticks and
yield()s to update, so it doesn't tell you usb is connected
early enough to be catched in this if(). I verified this on
the target.
(2) USB power only: Nice idea! I have one addition though -
this might also be useful for the FM and V2 recorders, to
charge from USB while using it.
(1) I see… We would need another fix then I guess. The
original patch also has this problem.
(2) It would be even better to include a menu option of
enabling this. When enabled, upon insertion of the cable it
could show a screen to ask if you want it to go to usb mode
or just use usb-power. This menu option thing isn't my idea,
someone on IRC mentioned it, i think Linus nielsen. I don't
have time to do it, so if someone really wants it he should do
it himself ;)
Enabling it for the recorder FM/V2 should not be a problem.
Just define HAVE_USB_POWER (i think i called it like this, just
check it in the ondio config) in the config files for the
recorder and change the used button if the other keypad is
used to something else.