Comment 16 for bug 345318

Revision history for this message
Bart Rose (jbrose3) wrote :

What about setting it to the value reported by laptop_panel.num_levels from hal. I borrowed the code below from https://fedorahosted.org/hal-cups-utils/browser/systemv/hal_lpadmin?rev=63db99983c74ba8c7efaee60e9b509e986a9204f for a possible way to incorporate the hal-get-property command. It should be possible to then set the output to GPM_BRIGHTNESS_DIM_LEVELS. I hope this makes sense, like I said before my coding skills are about 15 years rusty.

def get_hal_property(udi, key):
34 # Read out the value of a given key for a given HAL UDI
35 devnull = file ("/dev/null", "r+")
36 try:
37 p = subprocess.Popen (["hal-get-property", "--udi", udi,
38 "--key", key],
39 stdin=devnull,
40 stdout=subprocess.PIPE,
41 stderr=devnull)
42 (stdout, stderr) = p.communicate ()
43 return stdout.strip ()
44 except:
45 return ""