now | writings | rss | github | twitter | contact

but that is the traditional god and he's a terrible character

posted to writings on feb 16th, 2008 with tags acpi, laptops, nerd, openbsd, thinkpad, and x61

i started working on an acpi driver this evening to make my thinkpad x61 work better under openbsd. i just finished it and so far it matches on the IBM0068 acpi hid device, checks it for the appropriate version, enables the bluetooth device (which is required before the hardware toggle switch can power it on and let the ubt0 device show up), and sets up a callback to run whenever a special button (e.g., fn+f[1-9], brightness, thinklight, etc.) is pressed. i'm pretty sure it will work on most other thinkpads but i haven't tried it on my x40 yet.

i mapped out all of the events that get generated, which on my x61 tablet include the screen rotating around, the lid opening and closing, and even the pen being ejected from its little slot. when the brightness buttons (fn+home and fn+end) are pressed, it sends a cmos command through acpi to actually adjust the screen brightness accordingly, so now it's working just like my x40 did on its own. being able to turn the brightness down when on battery is the main reason i wrote this.

i'm still not sure what to do with the other key events, though. i'd like to setup a sysctl sensor that shows the status of the lid (there is already one from the aps device that shows whether it's open or closed, but not whether it's rotated around) and maybe hook up the brightness stuff to wscons so wsconsctl can adjust the screen brightness like it can on the zaurus. the rest of the keys will probably map to regular keycodes so x11 can see them and get mapped by applications.

either way, i'd like to set it up so when i rotate the screen around, something will see that sysctl value change and automatically run my rotation script to call xrandr to flip the display around and re-map the buttons on the screen. currently i have the physical "rotate" button on the bottom of the screen mapped to call that script so i have to push it whenever i flip the lid around, but what's the fun in that?

i could probably even hook into the sysctl values from the accelerometer on the x61 and call xrandr as needed so that the screen is always oriented properly depending on its physical position in space and the orientation of the lid.

Comments? Contact me via Twitter or e-mail.