Skip to content

Conversation

@stangri
Copy link
Member

@stangri stangri commented Aug 24, 2025

Maintainer: me
Compile tested: x86_64, Linksys MX4200v1, OpenWrt 24.10.2
Run tested: x86_64, Linksys MX4200v1, OpenWrt 24.10.2

Description:
This is a massive overwrite of the RPCD code from shell script to ucode which in turn brought:

  • update to the device json schema, which is now:
    • more structured
    • no weird names/object in json
    • customizable get, set, save commands per device (still need to be defined in ACL)
    • single partitions array now holding all data for toggling/labels/altMount
    • support for more than 2 bootable partition devices
  • a _device_json_transform.jq file to translate schema from old format to new one for any WIP devices
  • simplification of RPCD script as object can now be returned
  • adjustments to the Javascript to parse new error messages and new RPCD reply structure

I have tested both UBI volumes and dd-based information gathering on alternative partition, I'd still welcome:

  • tests on as many Linksys devices for actual partition toggling (rebooting to alternative)
  • tests for both information gathering and partition toggling on:
    • "d-link,dgs-1210-28"
    • "mercusys,mr90x-v1"
    • "zyxel,nbg6817"

I also gladly welcome any code reviews for both updated javascript and ucode.

@stangri stangri added WIP pull request the author is still working on Needs testing Need testing labels Aug 24, 2025
@stangri stangri force-pushed the master-luci-app-advanced-reboot branch 5 times, most recently from e4888b6 to 2920e18 Compare August 26, 2025 19:01
@stangri stangri removed WIP pull request the author is still working on Needs testing Need testing labels Sep 26, 2025
@stangri
Copy link
Member Author

stangri commented Sep 26, 2025

I've addressed the issues discovered in testing, unless there's any feedback it should be ready to merge.

If @systemcrash @stokito @champtar @Ramon00 or anyone else have time to review and comment on the new code, I'd be much obliged.

@systemcrash
Copy link
Contributor

Perhaps some more comments for each functions which give examples of sane input values - useful when following each step.

@stangri
Copy link
Member Author

stangri commented Sep 30, 2025

Perhaps some more comments for each functions which give examples of sane input values - useful when following each step.

sorry do you mean the RPC functions or all functions in ucode?

@systemcrash
Copy link
Contributor

Perhaps some more comments for each functions which give examples of sane input values - useful when following each step.

sorry do you mean the RPC functions or all functions in ucode?

ucode.

@stangri stangri force-pushed the master-luci-app-advanced-reboot branch from 2920e18 to 7c75fbb Compare September 30, 2025 20:54
return { label: label, os: kver };
}

/* Read current OS name from /etc/os-release, normalized for snapshot */
Copy link
Contributor

Choose a reason for hiding this comment

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

Are you sure? :)

Copy link
Member Author

Choose a reason for hiding this comment

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

do snapshots no longer use /etc/os-release ?

Copy link
Contributor

Choose a reason for hiding this comment

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

not if it's a comment for

function get_partition_info_current() {
	return get_volume_info("/");
}

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah, there used to be two different functions for current and alt info getters and now they use mostly the same code if the alt partition's UBI can be mounted. if you can suggest a more elegant code, please do.

Copy link
Contributor

Choose a reason for hiding this comment

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

My point was: is /* Read current OS name from /etc/os-release, normalized for snapshot */ a suitable comment for a function that does return get_volume_info("/");?

@stangri stangri force-pushed the master-luci-app-advanced-reboot branch 2 times, most recently from 7629aef to baf0320 Compare September 30, 2025 22:33
@stangri
Copy link
Member Author

stangri commented Oct 7, 2025

Still working on more comments for still "undocumented" functions as per @systemcrash advise.

@systemcrash
Copy link
Contributor

Still working on more comments for still "undocumented" functions as per @systemcrash advise.

A few that lack comments is OK - but a cursory hint to what most of the functions do is really helpful, especially to reviewers :)

@systemcrash
Copy link
Contributor

LGTM

@stangri stangri force-pushed the master-luci-app-advanced-reboot branch from baf0320 to 308a490 Compare October 8, 2025 01:09
This is a massive overwrite of the RPCD code from shell scrit to ucode which in turn brought:
* update to the device json schema, which is now:
  * more structured
  * no weird names/object in json
  * customizable get, set, save commands per device (still need to be defined in ACL)
  * single partitions array now holding all data for toggling/labels/altMount
  * support for more than 2 bootable partition devices
* a _device_json_transform.jq file to translate schema from old format to new one for any WIP devices
* simplification of RPCD script as object can now be returned
* adjustments to the Javascript to parse new error messages and new RPCD reply structure
* integrate @systemcrash provided code/suggestions

I have tested both UBI volumes and dd-based information gathering on alternative partition, I'd still welcome:
* tests on as many Linksys devices for actual partition toggling (rebooting to alternative)
* tests for both information gathering and partition toggling on:
  * "d-link,dgs-1210-28"
  * "mercusys,mr90x-v1"
  * "zyxel,nbg6817"

I also gladly welcome any code reviews for both updated javascript and ucode.

Signed-off-by: Stan Grishin <[email protected]>
@stangri stangri force-pushed the master-luci-app-advanced-reboot branch from 308a490 to 0a9ee78 Compare October 8, 2025 01:27
@stangri
Copy link
Member Author

stangri commented Oct 8, 2025

@systemcrash updated the ucode with (mostly AI-generated) function descriptions.

I've also tried to adjust the Makefile to generate the devices.json during build and remove no longer needed directories when building the package.

@stangri stangri requested review from stokito and systemcrash October 8, 2025 01:28
@systemcrash
Copy link
Contributor

ping @stangri

@stangri
Copy link
Member Author

stangri commented Dec 6, 2025

@systemcrash I'll be back mid-December, so hoping to push latest fix(es) and merge between then and X-mas.

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