Edward O'Callaghan wrote:
> Thanks Kerry, However I seen this already amd you seemed to have
> missed my question.
Sorry, see below my reply in-line. :-)
> Best Regards,
> Edward.
>
> 2009/3/3 Kerry Shu <Kerry.Shu at sun.com>:
>> Edward O'Callaghan wrote:
>>> Hey,
>>>
>>> I just got a new X301 and I been thinking about the recent hotkey support.
>>> Is this already been worked on for the X301 or should I start on it this
>>> week ?
No, I'm not aware of anyone is working on X301. You are quite welcome to
work on it.
>>> I hear Neal Pollack has code for the T61p. If I need to work on this
>>> could he please pass me this as a ref.
I don't have code for T61p. Cyril said he is going to work on it. I only
posted a hotkey driver template for reference.
Btw, since X301 and T610 are Lenovo models, wondering if they use same
ACPI method or not.
I'm still working on a guide for ACPI-based hotkey driver development.
Here I included part sections of it below. (I'll post the whole guide to
laptop community after I'm done.)
------------------------------------
3. ACPI hotkey driver
3.1 acpi_drv: generic ACPI video extensions.
acpi_drv supports brightness and display switch control method defined
in generic ACPI video extensions. (acpi_video.c)
Since generally, vendor specific method also covers brightness and
display switch control. In our design, acpi_drv is responsible to
load/unload vendor specific module(s). If there is a vendor specific
method module being loaded successfully, acpi_drv won't enable its ACPI
video extension support and all the hotkeys including brightness and
display switch will be handled by vendor specific module. Otherwise,
acpi_drv enables its ACPI video extension support to handle just
brightness and display switch hotkey.
3.2 Vendor specific ACPI hotkey driver: acpi_xxx
We currently have acpi_toshiba for Toshiba laptop hotkey support.
Other vendor specific hotkey support can be added one by one in
different module(acpi_xxx) in the future. The module naming rule
is: acpi_ + Vendor name. For example, acpi_lenovo, acpi_dell, etc.
3.3 Interface between acpi_drv and acpi_xxx(vendor specific ACPI
hotkey driver)
3.3.1 Vendor_hotkey_drv_list[]: apci_video.c
acpi_xxx needs to be registered in:
struct vendor_hotkey_drv vendor_hotkey_drv_list[];
so that acpi_drv can load/unload it.
A DDI_SUCCESS return form acpi_xxx`_init() means the vendor
specific ACPI method is found and initialized OK. So hotkey ACPI
events will be acpi_xxx instead of acpi_drv.
acpi_xxx module cean up code should be in _fini().
3.3.2 hotkey_drv.h: defines the interface between acpi_drv and acpi_xxx.
extern struct hotkey_drv acpi_hotkey;
=====================================
acpi_hotkey is the only shared structure variable between acpi_drv and
acpi_xxx.
typedef struct hotkey_drv {
struct acpi_drv_dev dev;
dev_info_t *dip;
void *private; /* Vendor specific structure */
kmutex_t *hotkey_lock;
int hotkey_method;
int modid;
int (*vendor_ioctl)(struct hotkey_drv *,
int cmd, intptr_t arg, int mode,
cred_t *cr, int *rval);
int (*vendor_fini)(struct hotkey_drv *);
boolean_t check_acpi_video;
void *acpi_video;
} hotkey_drv_t;
dev, dip: initialized in acpi_drv.
priviate: set and used by acpi_xxx only if it needs it.
hotkey_lock: initialized by acpi_drv. acpi_xxx can use it in ACPI
event notification handler.
hotkey_method: acpi_xxx need to OR it with HOTKEY_METHOD_VENDOR.
#define HOTKEY_METHOD_NONE 0x0
#define HOTKEY_METHOD_VENDOR 0x1
#define HOTKEY_METHOD_ACPI_VIDEO 0x2
#define HOTKEY_METHOD_MISC (HOTKEY_METHOD_VENDOR | \
HOTKEY_METHOD_ACPI_VIDEO)
modid: set and used in acpi_drv only.
vendor_ioctl: acpi_xxx needs to provide this xxx_ioctl(). Currently we
only have ioctl brightness handling. Pls see acpi_video_ioctl() in
acpi_video.c for reference.
vendor_fini: this is optional. Only for modules that would like to
provide one more fini function to acpi_drv() before their _fini()
being called.
check_acpi_video: this is optional and only for acpi_xxx which hotkey
method also depends on ACPI video extension method. In such case,
acpi_xxx needs to set it to B_TRUE in order to let acpi_drv to
go ahead and enable it's ACPI video extenstion support. Anyway,
the hotkey ACPI notifications will still be handed by acpi_xxx.
acpi_video: point to ACPI video support structure.
extern int hotkey_drv_debug;
============================
Shared variable to control the debugging code snippet.
#define HOTKEY_DBG_NOTICE 0x8000
#define HOTKEY_DBG_WARN 0x0001
function return value
=====================
#define HOTKEY_DRV_OK 0
#define HOTKEY_DRV_ERR -1
acpi_drv exported functions
===========================
int acpi_drv_set_int(ACPI_HANDLE dev, char *method, uint32_t aint);
void acpi_drv_gen_sysevent(struct acpi_drv_dev *devp, char *ev,
uint32_t val);
int acpi_drv_dev_init(struct acpi_drv_dev *p);
int acpi_video_ioctl(void *vidp, int cmd, intptr_t arg, int mode,
cred_t *cr, int *rval);
void hotkey_drv_gen_sysevent(dev_info_t *, char *);
4. Interface exported by ACPI hotkey driver
sysevent: usr/src/uts/common/sys/sysevent/eventdefs.h
-----------------------------------------------------
/* EC_ACPIEV subclass definitions */
#define EC_ACPIEV "EC_acpiev"
#define ESC_ACPIEV_DISPLAY_SWITCH "ESC_acpiev_display_switch"
#define ESC_ACPIEV_SCREEN_LOCK "ESC_acpiev_screen_lock"
#define ESC_ACPIEV_SLEEP "ESC_acpiev_sleep"
#define ESC_ACPIEV_AUDIO_MUTE "ESC_acpiev_audio_mute"
#define ESC_ACPIEV_WIFI "ESC_acpiev_wifi"
#define ESC_ACPIEV_TOUCHPAD "ESC_acpiev_touchpad"
5. Reference
1) A reference template for vendor specific ACPI hotkey driver
development. (solaris_acpi_hotkey_template.c)
2) acpi_drv source code:
http://cvs.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/i86pc/io/acpi_drv/
--------------------------------------------
Regards,
Kerry
>> See:
>> http://opensolaris.org/jive/thread.jspa?messageID=349129&tstart=0
>>
>> Regards,
>> Kerry
>>
>
>
>