Feature #485

Add support for config.txt editing in libpibox

Added by Hammel almost 2 years ago. Updated over 1 year ago.

Status:ClosedStart date:02 Jan 2016
Priority:ImmediateDue date:
Assignee:Hammel% Done:

100%

Category:-
Target version:PiBox - 0.11.0
Severity:01 - Critical

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.

Associated revisions

Revision b5ae8fbf
Added by Hammel almost 2 years ago

RM #485: Added stubs of rpi API for managing the config.txt file. Added stubs of unit test framework.

Revision e24ff4dc
Added by Hammel almost 2 years ago

RM #485: Completed rpi API for config.txt handling. Extended unit tests to cover basics of that API. Fixed bugs exposed in logging API while testing rpi API.

Revision 6fc0b6cc
Added by Hammel almost 2 years ago

RM #485: Test that value is an integer before further testing in validate_set. Fix log messages to include function name and remove extraneous memory free in validate_display_rotate. Make sure inputs are valid before saving them in rpiSetValue. Make sure required fields are added, if needed in rpiInit.

Revision 75ad4f7a
Added by Hammel almost 2 years ago

RM #485: Remove test-generated data file. General cleanup on ptests/rpi.c.

Revision 5ed31edd
Added by Hammel over 1 year ago

RM #485: Switch to GSList for config file processing to ensure FIFO processing of existing file content.

History

#1 Updated by Hammel almost 2 years ago

  • Description updated (diff)

#2 Updated by Hammel almost 2 years ago

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)

#3 Updated by Hammel almost 2 years ago

  • Status changed from New to In Progress
  • % Done changed from 0 to 10

#4 Updated by Hammel almost 2 years ago

  • % Done changed from 10 to 20

Added stubs of rpi API and unit test framework to libpibox.

#5 Updated by Hammel almost 2 years ago

  • % 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.

#6 Updated by Hammel almost 2 years ago

  • 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.

#7 Updated by Hammel almost 2 years ago

  • 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.

#8 Updated by Hammel over 1 year ago

  • 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