Bug 10760 - Dell automatic light sensor support missing
Dell automatic light sensor support missing
Status: RESOLVED WONTFIX
Product: hal
Classification: Unclassified
Component: misc
unspecified
Other All
: medium normal
Assigned To: David Zeuthen (not reading bugmail)
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-04-25 09:32 UTC by Bastien Nocera
Modified: 2011-08-26 04:24 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
dellAlsCtl.c (3.35 KB, text/plain)
2009-03-02 02:57 UTC, Nicolò Chieffo
Details
dellAlsCtl.c (3.36 KB, text/plain)
2009-03-02 03:02 UTC, Nicolò Chieffo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bastien Nocera 2007-04-25 09:32:06 UTC
From:
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=237768

---8<---
HAL doesn't seem to support Dell's Ambient Light Sensor. It can be used, in
hardware, by pressing Fn+Left arrow (auto brightness), and it will adjust the
display brightness automatically.
---8<---

And from David:
Can be solved by writing an addon implementing this interface

http://people.freedesktop.org/~david/hal-spec/hal-spec.html#device-properties-light-sensor

I did that in one day for my Macbook Pro... [...]
Comment 1 Michael Brown 2007-05-01 10:34:18 UTC
ALS can be turned on/off in software using the token interface:

Token interface:
    0x0187 - ALS OFF
        The panel brightness is controlled by the Fn+Up-arrow and
        Fn+Down-arrow keys and by the brightness fields in BIOS setup.
        They can be manipulated by OS-level applications as well.

    0x0188 - ALS ON
        Ambient Light Sensor (ALS) in certain notebook computers,
        controls the brightness of the notebook's LCD panel
        according to the amount of light in the surrounding environment.

You can use the libsmbios activateCmosToken binary to test this. I dont recommend using this binary from your API as this binary cmdline interface will probably change because it doesnt follow my coding style guidelines and is in the unsupported/ dir. You can use this as an example, though.
Comment 2 Michael Brown 2007-05-01 10:35:48 UTC
You can do more fine-grained control of ALS using the SMI interface. I dont know exactly how this interface works, the docs I have are not very verbose. Here is what I have:

SMI Interface:

    cbClass:  17
    cbSelect: 10
    Name:     Ambient Light Sensor Status and Control

    On entry:
    cbARG1, byte 0: Function to perform:
        0   Get ALS Status
        1   Control ALS
        2   Get Brightness Table

    If cbARG1, byte 0 is 1 (Control ALS):
    cbARG2, byte 0: Command
        0   Disable ALS
        1   Enable ALS
    cbARG2, byte 1: ALS low limit to set
    cbARG2, byte 2: ALS high limit to set

    On return:
    cbRES1: Return code
        0   Completed successfully
        -1  Completed with error
        -2  Function not supported

    If cbARG1 byte 0 was 0 (Get ALS Status):
    cbRES2, byte 0: Current ALS Status
        0   Disabled
        1   Enabled
    cbRES3, byte 0: Current ALS low limit
    cbRES3, byte 1: Current ALS high limit
    cbRES3, byte 2: Absolute ALS low limit
    cbRES3, byte 3: Absolute ALS high limit

    If cbARG1 byte 0 was 2 (Get Brightness Table):
    cbRES2: Bytes 3..0 of the brightness table
    cbRES3: Bytes 7..4 of the brightness table

You can use the libsmbios smi::doSimpleCallingInterfaceSmi() API to make
the SMI calls above. See the dellWirelessCtl or dellLedCtl binaries for examples.

Comment 3 Nicolò Chieffo 2009-02-28 10:39:40 UTC
Hello, I own a Latitude E6400, it has an ambient light sensor too.
I can help you to test something 

actually I see that libsmbios does not have "native" support for this in the utility dellLcdBrightness. I mailed the authors but still didn't receive any answer.

I *could* try to code something, but I can't find the source of dellLcdBrightness. Can you help me?
Comment 4 Nicolò Chieffo 2009-03-02 02:57:02 UTC
Created attachment 23435 [details]
dellAlsCtl.c

Compile with:
gcc -I /usr/include/smbios_c/ -l smbios_c dellAlsCtl.c -o dellAlsCtl

This is my try. there is no support for BIOS password yet. Anyway it works.
I implemented only the ALS status get/set, not other things.
Comment 5 Nicolò Chieffo 2009-03-02 03:02:16 UTC
Created attachment 23436 [details]
dellAlsCtl.c

better version
Comment 6 Nicolò Chieffo 2009-03-03 01:40:53 UTC
I have a question: what is "Als low/high limit"??
Comment 7 Danny Kukawka 2011-08-26 04:24:38 UTC
HAL is in maintenance mode - no new features are added. All future development focuses on udisks, upower and other parts of the stack. See Software/DeviceKit for more information.