Re: how to find out number of brightness levels supported by any given backlit keyboard via code?

On Sat, 2017-02-25 at 16:03 -0700, Gabriel M. Elder wrote:
Hi all,

A question for all the genius devs out there who are familiar with
the internal guts and plumbing of the gnome architecture and power

What is the preferred and/or most expedient way to find out, via
code, how many brightness state levels any given keyboard with
backlighting capabilities will support? Just for clarity, for
instance, I'm typing on a usb keyboard that has four brightness state
levels: 3 (100%), 2 (66.6%), 1 (33.3%), and 0 (off, emitting no
backlight). I'm looking to either utilize or create a way to
automatically discover or retrieve that information, in code.

I'm not necessarily looking for example code, per se. I just need to
know what modules to look at, function calls that could be made,
and/or objects that are responsible for maintaining this information
(if extant) that could or should be queried. Ideally, some function
call that returns an integer. Does something that simple or something
like it exist?

I know there's a keyboard proxy object from somewhere that gets used
in cc-power-panel.c, but I'm not very familiar with it, and perhaps I
should be looking elsewhere. If someone could point me in the right
direction, it would be a great time-saver.

The code is ultimately in UPower (src/up-kbd-backlight.c) and in the
kernel. /sys/class/leds/*kbd_backlight*/max_brightness is what you're
looking for.


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