You are not logged in.

#1 2012-04-04 14:09:49

Bladtman242
Member
Registered: 2012-02-14
Posts: 127

[solved] acpid doesnt work

Well, as the title says, acpid doesnt really do anything.
By writing $* to a file from the acpi/eventhandler.sh script, I've confirmed that the script does indeed receive events, and that they have the same names as the cases in the switch-case statement in the script

Iv'e also added this to the top of the script:

function echoTest {
        local bool=`[ "$1" -eq "ac_adapter" ] && echo true || echo false`
        echo $1 >> $TESTFILE
        echo "$1 matches ac_adapter: $bool" >> $TESTFILE
        echo "" >> $TESTFILE
}

echoTest $1 

the contents of the testfile (atfer plugging/unplugging the power coord) are this:

ac_adapter
ac_adapter matches ac_adapter: false

battery
battery matches ac_adapter: false

which makes me think the problem lies with some bash syntax I don't know about. (some kind of string expansion perhaps?)
Does anybody have a take on this? smile

Last edited by Bladtman242 (2012-04-04 15:30:22)

Offline

#2 2012-04-04 14:21:39

Bladtman242
Member
Registered: 2012-02-14
Posts: 127

Re: [solved] acpid doesnt work

Update: I tried putting an echo "FINE" >> $TESTFILE at the end of file.
I figured since there are no "exit" or  "exec" commands in the script, it should reach the bottom of the file at some point.
It doesn't however.
So maybe some other kind of syntactical error? or maybe something else exits the script, without my knowledge?
Here is the script , in its current form: http://pastebin.com/kBtYhSih.

Last edited by Bladtman242 (2012-04-04 14:22:36)

Offline

#3 2012-04-04 15:18:27

Bladtman242
Member
Registered: 2012-02-14
Posts: 127

Re: [solved] acpid doesnt work

Hah! Turned out to be the untimely comment in line 31.
I still don't get why

$1=ac_adapter
 [ "$1" -eq "ac_adapter" ] && echo true || echo false

echos false?
But at least it works now smile

Perhaps because "-eq" does integer comparison, so I was supposed to use "=" instead?

Anywho, closing the topic smile

Last edited by Bladtman242 (2012-04-04 15:29:55)

Offline

#4 2012-04-07 00:53:40

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,178

Re: [solved] acpid doesnt work

Try "=="


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#5 2012-04-07 09:06:20

Bladtman242
Member
Registered: 2012-02-14
Posts: 127

Re: [solved] acpid doesnt work

Nah, its '='.
But thanks anyway, it surprised me as well smile

Offline

Board footer

Powered by FluxBB