Skip to content

Support custom reset sequences - #21

Closed
kcxt wants to merge 3 commits into
linux-msm:masterfrom
kcxt:reset-sequence
Closed

kcxt wants to merge 3 commits into
linux-msm:masterfrom
kcxt:reset-sequence

Conversation

@kcxt

@kcxt kcxt commented Aug 21, 2023

Copy link
Copy Markdown
Member

Where hard power-sequencing is not available, do the next best thing and soft-reset the board via a button combination. As this behaviour isn't consistent between platforms, allow defining a custom reset sequence, as well as holding down the fastboot key until the device is actually detected in fastboot mode.

Deprecates #10

@kcxt kcxt mentioned this pull request Aug 21, 2023
3 tasks
@kcxt
kcxt force-pushed the reset-sequence branch 2 times, most recently from 4e15553 to 05e43a4 Compare August 21, 2023 13:22
Proper power sequencing with VBATT and VBUS supplies that can be
switched on and off can be tricky, especially for production devices
that use a battery rather than a 12v supply.

Add the ability to define a custom button sequence to reset a device,
this is necessary rather than hard-coding because the exact behaviour
can vary wildly on different devices.

Document this in the README and provide an example.

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
kcxt added 2 commits August 22, 2023 16:29
Some especially fun devices take an inconsistent amount of time to enter
fastboot mode. To avoid the reset sequence being longer than necessary,
add a callback from the udev monitor to release the fastboot key when
the board has been detected in fastboot.

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
For devices that must be reset with button presses, the dev-loop can be
sped up significantly by having these devices remain in fastboot when
not under test. Implement support for this by forking cdba-server on
exit and performing the reset sequence.

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
Comment thread device_parser.c
} else if (!strcmp(key, "reset_sequence")) {
parse_reset_sequence(dev, value);
} else if (!strcmp(key, "release_key_on_fastboot_detect")) {
dev->release_key_on_fastboot_detect = true;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Main question: shouldn't this be a default behaviour? IOW, is there a reason to hold fastboot key longer than necessary?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so no, currently it just holds the fastboot key for 1 second which is enough for dev boards but on some production devices they haven't actually reached the fastboot detection point yet.

I'll make it the default.

@konradybcio

Copy link
Copy Markdown
Member

pressing RESIN+PWR for n seconds (n = no more than like 10 or 15, i think it maaaaaay be configurable?) guarantees a hard reset

@lumag

lumag commented Sep 21, 2023

Copy link
Copy Markdown
Contributor

Generic question: for me this looks like a perfect usecase for external scripts, which would specify particular behaviour for the board.

@kcxt

kcxt commented Sep 24, 2023

Copy link
Copy Markdown
Member Author

pressing RESIN+PWR for n seconds (n = no more than like 10 or 15, i think it maaaaaay be configurable?) guarantees a hard reset

@konradybcio the issue is if you hold for too long then you end up getting to fastboot and triggering the first fastboot option which gets everything confused XD

@kcxt

kcxt commented Sep 24, 2023

Copy link
Copy Markdown
Member Author

I hooked up my pico to control the enable pin of the buck converter I have as a battery replacement, this makes all the button wrangling unecessary as I can just erase the boot partition and the devices always boot straight to fastboot mode.

There is maybe some value in this PR for someone else, but given the amount of finesse necessary to get this to work reliably, I'm not gonna stick with it... See #33

@kcxt kcxt closed this Sep 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants