Skip to content

Command-line argument syntax enhancement suggestion #14

@GeographicCone

Description

@GeographicCone

Thank you for your work. The tool runs great for me with no bugs. This is just an enhancement suggestion for consideration. There are two very minor things I noticed:

  1. For a clumsy person such as myself, it's easy to write something accidentally, which could be addressed if -w had to be prepended before the value to be written (i.e. no -w, no write).
  2. Having to type -s 0x2 instead of even just -s 2 is mildly annoying.

This however got me thinking how the command-line arguments could be rethought in general. What if the syntax were instead:

  • setup_var.efi [VarStoreName:]<Offset>[(Size)][=NewValue]

For example:

  • setup_var.efi 0x0CA9 Read a byte at offset 0x0CA9 from Setup (backward-compatible)

  • setup_var.efi SaSetup:0x0F(2) Read a word (two bytes) at offset 0x0F from SaSetup

  • setup_var.efi AMITSESetup:0x40=0x01 Write 0x01 to AMITSESetup at offset 0x40

This would have the added benefit that the tool could iterate through multiple white space-separated commands in one go:

  • setup_var.efi SaSetup:0x018D=0x01 SaSetup:0x05=0x01 SaSetup:0x06=0x30 SaSetup:0x0F(2)=0x1250

It's not a contrived example. On the laptop I have, the above sets the memory profile to Custom, reference clock to 100MHz, ratio to ×48, and Refresh Time (tREFI) to 4688.

And in the future, multiple commands could also be read from a file, for example:

  • setup_var.efi < my_tweaks.txt

While in an even more distant future, where variables could be set and referenced, the said file could look:

# Define offsets
$MemProfile=SaSetup:0x018D
$MemClock=SaSetup:0x05
$MemRatio=SaSetup:0x06
$MemIntREFI=SaSetup:0x0F(2)

# Apply changes
@MemProfile=0x01
@MemClock=0x01
@MemRatio=0x30
@MemIntREFI=0x1250

I think this would make it slightly more convenient to use (not that it isn't now), and a bit less prone to user error.

Of course I realize it's your project and your time. It's great as it is, and thank you for making it available. This is just food for thought. Hope you don't mind my sharing this idea.


Edit: There's one other thing I forgot to mention. With the above argument structure, the output from the program could be exactly in the same format that it would also accept back as the input, for example:

% setup_var.efi SaSetup:0x0F(2)
SaSetup:0x0F(2)=0x1250

This way it could be easily saved to a file:

setup_var.efi SaSetup:0x018D SaSetup:0x05 SaSetup:0x06 SaSetup:0x0F(2) > my_defaults.txt

And then restored:

setup_var.efi < my_defaults.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions