[PATCH] acpid: add config file and map file
Souf Oued
souf_oued at yahoo.fr
Sun Sep 26 09:43:49 UTC 2010
Le 25/09/2010 23:57, Denys Vlasenko a écrit :
> On Monday 20 September 2010 13:27, Souf Oued wrote:
>
>> Le 20/09/2010 13:00, Souf Oued a écrit :
>> This patch adds these three options to acpid:
>> 1/ acpid -p pidfile
>> 2/ acpid -a /etc/acpid.conf
>> acpid.conf syntax is like this:
>> KEY ACTION
>> PWRF /etc/acpi/power_btn.sh
>> BAT0 /etc/acpi/battery.sh
>> ...
>>
>> 3/ acpid -M /etc/acpi.map
>> acpi.map syntax is like this:
>> #s_type n_type(hex) s_code n_code value description
>> EV_KEY 0x01 KEY_MUTE 113 1
>> button/mute MUTE 00000080 00000000
>> EV_KEY 0x01 KEY_POWER 116 1
>> button/power PWRF 00000080 00000000
>> ...
>>
>> The purpose of these files is to avoid using hard-coded values in acpid
>> and no longer depend on linux/input.h.
>> Obviously, if there is not one of these files, acpid ensures a minimum
>> service, this makes it flexible and
>> configurable for different needs
>>
> Thanks.
>
> function old new delta
> acpid_main 434 1161 +727
> find_action - 204 +204
> f_evt_tab - 48 +48
> packed_usage 27724 27750 +26
> f_act_tab - 16 +16
> process_event 126 - -126
> ------------------------------------------------------------------------------
> (add/remove: 3/1 grow/shrink: 2/0 up/down: 1021/-126) Total: 895 bytes
> text data bss dec hex filename
> 876755 936 17196 894887 da7a7 busybox_old
> 877731 1000 17196 895927 dabb7 busybox_unstripped
>
> The growthc in data comes from
>
> static struct acpi_event f_evt_tab[] = {
> {"EV_KEY", 0x01, "KEY_POWER", 116, 1, "button/power PWRF 00000080 00000000"},
> {"EV_KEY", 0x01, "KEY_POWER", 116, 1, "button/power PWRB 00000080 00000000"},
> };
>
> static struct acpi_action f_act_tab[] = {
> {"PWRF", "PWRF/00000080"},
> {"LID0", "LID/00000080"},
> };
>
> Can these objects be made const?
>
>
> char dev_event[sizeof("/dev/input/event") + sizeof(int)*3];
> ...
> getopt32(argv, "c:e:l:dp:a:M:" IF_FEATURE_ACPID_COMPAT("g:m:s:S:v"),
> &opt_dir,&opt_input,&opt_logfile,&opt_pidfile,&opt_action,&opt_map
> ...
> sprintf(dev_event, opt_input, (option_mask32& OPT_e) ? : nfd);
>
> Looks like dev_event[] may be easily overflowed with -e LONG_STRING.
>
>
>
Ok, I modified, I use xasprintf instead of char
dev_event[sizeof("/dev/input/event") + sizeof(int)*3]
Thanks
-------------- next part --------------
A non-text attachment was scrubbed...
Name: busybox-1.17.2-acpid.patch
Type: text/x-diff
Size: 10728 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20100926/95b014f0/attachment-0001.bin>
More information about the busybox
mailing list