You are not logged in.
Pages: 1
Hi all,
is this tool available for arch, perhaps as part of some existing package?
http://www.mike.tl/other/ThinkAlert.html
Thanks in advance & kind regards,
jamesbond007.
Last edited by jamesbond007 (2010-07-20 19:58:19)
Offline
Hi all,
is this tool available for arch, perhaps as part of some existing package?
http://www.mike.tl/other/ThinkAlert.html
Thanks in advance & kind regards,
jamesbond007.
Depends on what you want to do with it.
AUR has this http://aur.archlinux.org/packages.php?O … _Search=Go
which allows you to blink the light on incoming kopete /pidgin messages. There is also a tpb package in community (i believe) which may have included the light functionality, I am not a 100% sure. If all else fails, I could package it up for you in AUR. (Can we call dibs on building packages ? )
Last edited by Inxsible (2010-07-15 19:38:50)
There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !
Offline
Hi Inxsible,
thanks for your quick answer.
Depends on what you want to do with it.
AUR has this http://aur.archlinux.org/packages.php?O … _Search=Go
I would like to use it from within my own scripts, so the plugins for pidgin and kopete do not really help me.
There is also a tpb package in community (i believe) which may have included the light functionality, I am not a 100% sure.
I inspected the filelist of the tpb package and I think it does not contain what I would like to have. Unfortunately, I don't have my thinkpad here right now, I have left it at the office.
If all else fails, I could package it up for you in AUR.
That would be very kind of you! - I already read the basics about creating PKGBUILDs, because I would like to learn it myself - but I guess my knowledge about compiling and packaging software is still close to nothing.
Thanks in advance,
jamesbond007.
Offline
Ok, I will try to get you a PKGBUILD later tonight. I am at work right now and supposedly should be doing what my boss pays me for
There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !
Offline
Here's the package in AUR as promised.
Please test it out and let me know if it installs correctly.
Last edited by Inxsible (2010-07-15 23:33:14)
There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !
Offline
Here's the package in AUR as promised.
Thank you very much!
Please test it out and let me know if it installs correctly.
Well yes, it installs correctly without any issues using yaourt. But I have a problem when I try to call /usr/bin/thinkalert from the command line: While this does work as root, it does not work as a regular user.
As root:
# /usr/bin/thinkalert
thinkalert <on|off>
thinkalert <times> [interval (microseconds)]
thinkalert <times> <on period (microseconds)> <off period (microseconds)>
# /usr/bin/thinkalert 2
<no output, light flashes two times as expected>
As regular user:
> /usr/bin/thinkalert
Unable to open the ThinkLight interface: Permission denied
> /usr/bin/thinkalert 2
Unable to open the ThinkLight interface: Permission denied
Now the question is: How can I get this to work as a regular user? Is this a configuration issue (e.g. permission for a device needs to be changed) or is a modification of the thinkalert package necessary?
Thanks in advance & kind regards,
jamesbond007.
Offline
I guess this is the problem:
> ls -l /proc/acpi/ibm/light
-rw-r--r-- 1 root root 0 Jul 16 11:41 /proc/acpi/ibm/light
Doing "chmod a+w /proc/acpi/ibm/light" (as root) seems to solve the problem temporarily. But as the proc file system is a pseudo-file system, I guess that this "solution" will only last until the next reboot. So what do I need to do to solve the problem permanently?
Offline
Ok.
I just followed the instructions on the website that you linked, to build the PKGBUILD and they chown the thinkalert to root. He hasn't mentioned why.
I guess if I remove the chown, then your regular user could use it as well. Later tonight !!
Last edited by Inxsible (2010-07-16 14:53:25)
There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !
Offline
I would rather use a shell script than C executable for something simple as this, so I wrote something quick and dirty. Maybe somebody else is interested as well:
#!/bin/sh
[[ $# < 2 || $# > 3 ]] && echo "Wrong number of arguments: $#
Usage:
thinkalert <times> [interval (s)]
or
thinkalert <times> <on period (s)> <off period (s)>
" && exit 64
light=/proc/acpi/ibm/light
onperiod=$2
[[ $# = 2 ]] && offperiod=$2 || offperiod=$3
for ((i=1;i<=$1;i++))
do
echo on > $light
sleep $onperiod
echo off > $light
[[ $i = $1 ]] && exit 0 || sleep $offperiod
done
As for the permissions, personally I would rather add my user to sudoers for the thinkalert command by adding something like this to the sudoers file:
username ALL=NOPASSWD:/home/username/bin/thinkalert
Then you can use the command like this in your scripts without being prompted for your password:
sudo thinkalert 5 0.3 1
Last edited by akuschki (2010-07-16 20:02:12)
Offline
Hi akuschki,
thank you very much for your script, which I can adapt for my own purposes. I did not realize before that it is really so simple!
One question remains: As I don't have sudo installed, is there another approach to solve the permission problem? - I was thinking about using the suid-bit, but IIRC, the suid-bit does not work for scripts (only for binary executables).
Kind regards,
jamesbond007.
Offline
You're welcome. Unfortunately I don't know anything about the suid-bit business: problems like this are the reason I use sudo; it just seems to be the sanest way of handling these permission problems. Any particular reason why you prefer not to use sudo? (let me guess: you're a minimalist and detest bloat
The only other things I can think of are - as mentioned above - using chown or chmod to change /proc/acpi/ibm/light at every startup, or alternatively executing your script as super user. The former seems to be much preferable. But there might be other ways and I am sure you can get an answer on the thinkpad-linux mailing list if you ask there (http://mailman.linux-thinkpad.org/mailm … x-thinkpad). The developer of thinkpad-acpi (and hence /proc/acpi/ibm/light) is there as well.
Last edited by akuschki (2010-07-20 19:22:22)
Offline
Any particular reason why you prefer not to use sudo?
No, not really. I just never used it and thus have no experience in using it. That's all.
If I install sudo, can I still use the root user and do everything like I did it before? I mean just use /etc/sudoers to solve the permission problem, and otherwise continue to ignore sudo? Would that work?
Offline
If I install sudo, can I still use the root user and do everything like I did it before? I mean just use /etc/sudoers to solve the permission problem, and otherwise continue to ignore sudo? Would that work?
yes sure. you can always do su to become the super user even when sudo is installed. or you can use sudo -s, which has the same effect but some advantages.
Offline
Thanks again for your help, akuschki and Inxsible! --> Thread marked as solved.
Offline
Pages: 1