Re: [gpm] Support for brightness_in_hardware hal property



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi

>> Hm. It looks like gpm_brightness_xrandr_output_get_internal() doesn't 
>> detect that the hardware has changed the brightness.
>>
>> If I disable gpm_brightness_xrandr_output_set_internal(), then 
>> output_get always returns the same value, regardless of the actual state 
>> of the backlight.
>>
>> So even if you use hal attribute, you can't get the real brightness 
>> level through xrandr.
> 
> Right, so this sounds like a X bug. When we do a query brightness, we
> should always check the hardware and not use a cached value. Can you
> open a bug against the X driver you are using please?

I've created a short program that tries to demonstrate this problem. It
uses the same way of getting brightness level from xrandr as g-p-m.

On my Eee, it will output the same value regardless of the actual
backlight setting.

Can someone please check if this works properly on some other hardware?
(i.e. if the value printed changes when you change the brightness level)
I can then file a bug for the Intel X.org driver.

Thanks
Tomaž
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIjO2asAlAlRhL9q8RAjUDAKCU/JwwOoimpTfHZh9FCttlfjwcYACfcMdN
+jKe/CBaSR4mbjKYSuFHXD8=
=oquy
-----END PGP SIGNATURE-----
#include <stdio.h>

#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <X11/Xlib.h>
#include <X11/extensions/Xrandr.h>

int main() {
	Display *dpy;
	dpy = XOpenDisplay(":0.0");
	if(!dpy) {
		printf("Display\n");
		return 1;
	}

	Screen *scr;
	scr = XDefaultScreenOfDisplay(dpy);
	if(!scr) {
		printf("Screen\n");
		return 1;
	}

	Window root = RootWindowOfScreen(scr);

	Atom backlight = XInternAtom(dpy, "BACKLIGHT", True);
	if(backlight == None) {
		printf("Backlight Atom\n");
	}

	XRRScreenResources *resource;
	resource = XRRGetScreenResources(dpy, root);
	if(!resource || resource->noutput < 1) {
		printf("Resource\n");
		return 1;
	}

	printf("%d outputs\n", resource->noutput);

	int i;
	for(i = 0; i < resource->noutput; i++) {
		printf("%d\n", i);
		RROutput output = resource->outputs[i];

		unsigned long nitems;
		unsigned long bytes_after;
		unsigned char *prop;
		Atom actual_type;
		int actual_format;

		if(XRRGetOutputProperty(dpy, output, backlight,
					 0, 4, False, False, None,
					 &actual_type, &actual_format,
					 &nitems, &bytes_after, &prop) != Success) {
			printf("XRRGetOutputProperty\n");
		}

		if (actual_type == XA_INTEGER && nitems == 1 && actual_format == 32) {
			printf("Brightness setting: %d\n", *((int *) prop));
		}
	}

	return 0;
}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]