Feature #485
closed
Add support for config.txt editing in libpibox
Added by Hammel almost 9 years ago.
Updated almost 9 years ago.
Description
The config.txt for the Raspberry Pi is rather large, but it can be supported in phases, providing support for the most commonly edited features first.
Here is the complete config.txt. The API doesn't need to generate comments, just name=value pairs.
- Description updated (diff)
Here is what the API should look like:
- rpiInit(path) - load and parse the file into a list of name/value pairs. Returns 0 on success, 1 on failure. Does not validate existing names.
- rpiSet(name, value) - Update the specified name with the specified value. If name does not exist, add it if its a valid name. Returns 0 on succes, 1 on failure (not a valid name).
- rpiNames() - returns a list of supported names. This will not be the complete set of configuration options available to config.txt. It is only what is supported by the API.
- rpiValues(name) - returns a list of support values for the specified name. Returns null if the name is not valid.
- rpiGetValue(name) - returns the current value for the specified name
- rpiSave(path) - save current configuration. Does not validate configuration when writing.
The initial set of valid names that will be supported are:
- Overscan
- disable_overscan
- overscan_left
- overscan_right
- overscan_top
- overscan_bottom
- HDMI
- hdmi_safe
- hdmi_drive
- hdmi_mode
- decode_MPG2 (licensed code for MPEG-2 decoding)
- display_rotate
- Overclock
- arm_freq - setting this automatically sets the others
- core_freq
- sdram_freq
- over_voltage
- Memory
- gpu_mem_256 or gpu_mem_512
These values are preset to these values if not found in the config file.
- hdmi_ignore_edid_audio=1
- disable_splash=1
- dtparam=act_led_trigger=heartbeat (instead of mmc, so I can see processor load)
- Status changed from New to In Progress
- % Done changed from 0 to 10
- % Done changed from 10 to 20
Added stubs of rpi API and unit test framework to libpibox.
- % Done changed from 20 to 50
Most of this is done now although I still need to verify that required fields are included. I also need to add unit tests for each field to make sure I can only add valid values.
I dropped the gpu memory setting. That seems less like a user configurable item than the others.
- Status changed from In Progress to Closed
- % Done changed from 50 to 100
Added unit tests for field values.
All changes committed and pushed.
Closing issue.
- Status changed from Closed to In Progress
- % Done changed from 100 to 80
Reopening issue: the use of a hash table was a bad idea. I can't guarantee the ordering of the output to match the input so I munge the input file.
I need to switch to using either singly-linked lists (which is what I started with) or queues. Since this isn't a high activity collection the penalties for using lists isn't really an issue. So I think I'll go back to using lists where the data is a structure with name/value that I can use for searching, replacing, etc.
- Status changed from In Progress to Closed
- % Done changed from 80 to 100
Switched to GSList. Updated tests and verified working.
Committed and pushed.
Closing issue again.
Also available in: Atom
PDF