<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.thinkwiki.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Kiraven</id>
	<title>ThinkWiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://www.thinkwiki.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Kiraven"/>
	<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/wiki/Special:Contributions/Kiraven"/>
	<updated>2026-04-20T17:50:50Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.31.12</generator>
	<entry>
		<id>https://www.thinkwiki.org/w/index.php?title=Script_for_theft_alarm_using_HDAPS&amp;diff=45953</id>
		<title>Script for theft alarm using HDAPS</title>
		<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/w/index.php?title=Script_for_theft_alarm_using_HDAPS&amp;diff=45953"/>
		<updated>2010-02-11T18:36:32Z</updated>

		<summary type="html">&lt;p&gt;Kiraven: /* Prerequisites */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==General==&lt;br /&gt;
&lt;br /&gt;
Recent ThinkPad models include a built-in two-axis accelerometer, as part of the [[HDAPS]] feature. This accelerometer can be put to another use: as a laptop theft deterrent. The following scripts detect when the laptop is moved, and emits a loud audio alarm. &lt;br /&gt;
&lt;br /&gt;
This alarm can be an effective deterrent against a casual laptop-snatcher in a populated environment (e.g., typical office space). It's also useful when you're across the room from the laptop and want to know if someone fiddles with it.&lt;br /&gt;
&lt;br /&gt;
Note that the alarm is disabled when the laptop is suspended or powered off. You can buy external (hardware) motion detector alarms to handle those cases.&lt;br /&gt;
&lt;br /&gt;
{{WARN|The audio alarm is played at a very high volume. Never enable the alarm while wearing headphones connected to the laptop's speaker output or when the laptop is connected to a high-power amplifier.}}&lt;br /&gt;
&lt;br /&gt;
==A comprehensive script==&lt;br /&gt;
&lt;br /&gt;
This Perl script periodically samples the tilt data reported by the accelerometer, computes the variance over recent samples, and triggers the alarm when the variance exceeds a given threshold.&lt;br /&gt;
&lt;br /&gt;
On a ThinkPad with [[Active Protection System]] running a modern Linux installation with the [[HDAPS|hdaps]] kernel module loaded, the script should work as is. Just run {{cmdroot|tp-theft --arm}} and see (or rather, hear) what happens when you tilt your laptop. &lt;br /&gt;
&lt;br /&gt;
The volume and alarm sound can be adjusted at the top of the script. On a ThinkPad {{T43}}, the synthetic siren at &amp;lt;tt&amp;gt;$alarm_volume=100&amp;lt;/tt&amp;gt; (up from the default 70) is quite ear-splitting, and combined with &amp;lt;tt&amp;gt;$acpi_volume=15&amp;lt;/tt&amp;gt; it is dangerously loud.&lt;br /&gt;
&lt;br /&gt;
The script is designed to run continuously in the background, so by default the alarm will be activated only when the KDE screen saver is locked. If you you open the laptop lid (or press the lid button) shortly before or after the beginning of movement, the alarm will be suspended (except for a brief warning) and you will get a few seconds of grace to unlock the screen saver (preferably, [[How to enable the fingerprint reader|using the integrated fingerprint reader]]!). You can disable this functionality by passing the &amp;lt;tt&amp;gt;--arm&amp;lt;/tt&amp;gt; parameter, by setting &amp;lt;tt&amp;gt;$use_kde=0&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;$use_lid=0&amp;lt;/tt&amp;gt;, or by using the simpler script below.&lt;br /&gt;
&lt;br /&gt;
There is also an option to track a BlueTooth device (e.g., a mobile phone). In this case, the alarm is activated (and optionally, the KDE desktop is locked) whenever the device is turned off or too distant for a given period, and deactivated when the BlueTooth device is nearby. You need to provide the device's BD address. If both KDE screen saver and BlueTooth checking are enabled, then the alarm will be activated when *either* the screensaver is enabled or the BlueTooth device is amiss.&lt;br /&gt;
&lt;br /&gt;
===Prerequisites===&lt;br /&gt;
&lt;br /&gt;
* ThinkPad with [[Active Protection System]]&lt;br /&gt;
* [[HDAPS|hdaps]] kernel module loaded (included in kernel 2.6.14 and later)&lt;br /&gt;
* Optional: [[ibm-acpi|ibm_acpi]] module loaded with the &amp;lt;tt&amp;gt;experimental=1&amp;lt;/tt&amp;gt; parameter (included in kernel 2.6.14 and later; needed only for full volume control)&lt;br /&gt;
The following are included in all modern Linux distributions:&lt;br /&gt;
* ALSA sound system, &amp;lt;tt&amp;gt;alsactl&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;aplay&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;amixer&amp;lt;/tt&amp;gt; )&lt;br /&gt;
* &amp;lt;tt&amp;gt;sox&amp;lt;/tt&amp;gt; (SOund eXchange) sound utility&lt;br /&gt;
&lt;br /&gt;
===The script===&lt;br /&gt;
{{CodeRef|tp-theft}}&lt;br /&gt;
&lt;br /&gt;
==A basic script==&lt;br /&gt;
&lt;br /&gt;
This is a simpler version of the above script, which omits the fancier functionality such as KDE screensaver detection, lid detection and state machine.&lt;br /&gt;
&lt;br /&gt;
===Prerequisites===&lt;br /&gt;
&lt;br /&gt;
* ThinkPad with [[Active Protection System]]&lt;br /&gt;
* [[HDAPS|hdaps]] kernel module loaded (included in kernel 2.6.14 and later)&lt;br /&gt;
* &amp;lt;tt&amp;gt;aumix&amp;lt;/tt&amp;gt; mixer control utility (included in all modern Linux distributions)&lt;br /&gt;
* &amp;lt;tt&amp;gt;sox&amp;lt;/tt&amp;gt; (SOund eXchange) sound utility (included in all modern Linux distributions, e.g. packages &amp;quot;sox&amp;quot; and &amp;quot;libsox-fmt-oss&amp;quot; in Ubuntu)&lt;br /&gt;
* in newer Versions of sox (e.g. shipped with current Ubuntu), the used parameters are no longer supported. You have to replace &amp;quot;-t nul /dev/null&amp;quot; with &amp;quot;-n&amp;quot; in line 19.&lt;br /&gt;
&lt;br /&gt;
===The script===&lt;br /&gt;
&lt;br /&gt;
{{CodeRef|tp-theft-basic}}&lt;br /&gt;
&lt;br /&gt;
==Ideas for improvement==&lt;br /&gt;
Features awaiting contribution:&lt;br /&gt;
&lt;br /&gt;
===Activation===&lt;br /&gt;
* Gnome and xscreensaver support (similarly to [http://fdd.com/software/radeon/lightwatch.pl lightwatch.pl]?)&lt;br /&gt;
* Monitor X server presence  and make noise on sudden X server shutdown (i.e. catch {{key|ctrl}}{{key|alt}}{{key|backspace}} events).&lt;br /&gt;
* Monitor AC power and take it into account for alarm activation -- thieves seldom carry a UPS.&lt;br /&gt;
* Don't arm the alarm if movement of similar magnitude was happening also before the screensaver was auto-locked (the owner might be in a moving vehicle, etc.).&lt;br /&gt;
* Disarm the alarm (or hold it off for a few seconds, as already implemented for lid open) based on voice/sound recognition using the built-in microphone.&lt;br /&gt;
* Use fingerprint reader to disarm the alarm.&lt;br /&gt;
&lt;br /&gt;
===Precaution===&lt;br /&gt;
* Disable the alarm when headphones are plugged in -- it may cause hearing damage (if the user ignores the initial warning), and won't be effective anyway. '''Can we detect whether the something is plugged into the headphones/line-out socket?'''&lt;br /&gt;
* Theft attempts may be accompanied by rough handling, especially when the siren kicks in. So when starting an alarm also park the disk heads. Release the parking when a key is pressed (according {{path|/sys/bus/platform/drivers/hdaps/hdaps/keyboard_activity}}) so that the login prompt can start up. This requires kernel support for disk head parking and queue freezing, currently developed for the (original) HDAPS functionality.&lt;br /&gt;
&lt;br /&gt;
===Indication===&lt;br /&gt;
* Use XOSD to ivisually ndicate state changes.&lt;br /&gt;
* Use TrayIcon to indicate state changes.&lt;br /&gt;
* Use Notifications to indicate state changes.&lt;br /&gt;
&lt;br /&gt;
===Lockdown===&lt;br /&gt;
* Disable the volume buttons when the script is running so that a thief can't just turn the volume down. (Not an issue when &amp;lt;tt&amp;gt;ibm_acpi&amp;lt;/tt&amp;gt; volume control is available - see [[#Prerequisites|Prerequisites]].)&lt;br /&gt;
* Disable suspend and powersaving measures when armed.&lt;br /&gt;
* Disable poweroff (to the extent possible) when armed - or at least use the two seconds the power button acpi function comes active before poweroff to make as much noise as possible (it may take a while for a casual thief to actully remove the battery).&lt;br /&gt;
&lt;br /&gt;
===Alert===&lt;br /&gt;
* Start out quietly, and increase siren duration and volume if movement persists. Reset after a period of no movement.&lt;br /&gt;
* Report theft via network (if you get a chance to):&lt;br /&gt;
**Check for presence of wired or open wireless network and connect if not already connected.&lt;br /&gt;
**Send eMail to email to sms gateway or use an online sms service.&lt;br /&gt;
**If builtin webcam is present, take shots and upload them to a server or send via email. (This could be activated over a reboot, so that even if the thief gets away with the laptop, it would still be somewhat traceable.)&lt;br /&gt;
**If WAN of GPS devices are present, use it to detect position to a web server.&lt;br /&gt;
* When the alarm is triggered, also show a visual warning on the display. Override screensaver/powersaving if necessary. I.e., inform the thief that the notebook has a power on password and is useless without it. (This can be done by selecting a dedicated screensaver for that purpose.)&lt;br /&gt;
* Eject optical drive to irritate and hence slow down the thief.&lt;br /&gt;
&lt;br /&gt;
===Other===&lt;br /&gt;
* Implement this functionality in the embedded controller, so that the alarm will work even when the laptop is suspended. It may be possible to do so without IBM/Lenovo's involvement, using the [http://forum.thinkpads.com/viewtopic.php?t=20958 embedded controller disassembly].&lt;br /&gt;
* On Ubuntu, some of the paths don't work. alsactl is in /sbin, not /usr/sbin, and pidof is in /bin, not /sbin. These probably shouldn't be hardcoded paths. (Fix: create symlinks)&lt;br /&gt;
&lt;br /&gt;
==Pitfalls (and solutions?)==&lt;br /&gt;
* The audible alarm can always be suppressed by plugging earphones into the audio-jack (could be dealt with if software override for the audio-jack diversion is possible).&lt;br /&gt;
* The power button can be held to hard poweroff the notebook (can be avoided by using usb/bluetooth detection, closing the lid and sounding alarm if lid is opened before the usb/bluetooth device is present).&lt;br /&gt;
* The thief can unplug the battery to hard poweroff the notebook (can't do anything about it, but to set the alarm settings so that it goes off quickly - i.e., when using bluetooth detection, disable grace-period if activated manually)&lt;br /&gt;
&lt;br /&gt;
==Another Script (plugin-based)==&lt;br /&gt;
there's another script with the same intention available at http://www.informatik.hu-berlin.de/~pilop/HOWTO_Gentoo_T43/#TheftAlarm&lt;br /&gt;
&lt;br /&gt;
it uses a plugin-architecture for different checks (HDAPS, ethernet, power, lid, ...)&lt;br /&gt;
&lt;br /&gt;
==Yet another script (python/gtk based)==&lt;br /&gt;
You can find yet another version of this script at&lt;br /&gt;
&lt;br /&gt;
http://r3blog.nl/index.php/thinkpad-theft&lt;br /&gt;
(source at https://bitbucket.org/trbs/thinkpad-theft/overview/)&lt;br /&gt;
&lt;br /&gt;
It has almost the same features as the comprehensive script above, with a few improvements. It uses dbus to query the screensaver status and gconf for storing configuration value. To improve the delay before the alarm sounds, it has a built-in wav player, and it opens the file-descriptor of the wav at startup time (thereby removing the need to spawn an application to play the alarm; imagine someone stealing your laptop while you're doing heavy disk io). Furthermore, it has a trayicon allowing you to manipulate most settings stored in gconf aswell as showing you the current status of the alarm. The 0.2 release features activation on missing presence of a bluetooth or usb device.&lt;br /&gt;
&lt;br /&gt;
There is a [https://bitbucket.org/trbs/thinkpad-theft/overview new repository] at BitBucket that has seen some patches to fix problems with the unstable dbus-screensaver api and more.&lt;br /&gt;
&lt;br /&gt;
==Conceptional thoughts==&lt;br /&gt;
The above feature improvement suggestions partly require the theft protection software to be running as root (ACPI and hardware management), partly to be running as user (DBus SessionBus communications). Hence the following approach would be the one opening for the most coverage:&lt;br /&gt;
*theft-protection-daemon; run as root by init; controlling config, system related activation, lockdown and alarm&lt;br /&gt;
*theft-protection-trayicon; run in user-session; reporting desktop related activation criteria to the daemon and giving visual user feedback on the desktop&lt;br /&gt;
*theft-protection-properties; runnable as user; reporting configuration changes to daemon&lt;br /&gt;
&lt;br /&gt;
Ideally, they would provide a plugin-system, with plugins consisting of a functional and a gui part.&lt;br /&gt;
With this scheme, the theft protection can't be circumvented i.e. by pressing {{key|ctrl}}{{key|alt}}{{key|backspace}}.&lt;br /&gt;
&lt;br /&gt;
[[Category:Scripts]]&lt;/div&gt;</summary>
		<author><name>Kiraven</name></author>
		
	</entry>
	<entry>
		<id>https://www.thinkwiki.org/w/index.php?title=Installation_instructions_for_the_ThinkPad_T400&amp;diff=44824</id>
		<title>Installation instructions for the ThinkPad T400</title>
		<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/w/index.php?title=Installation_instructions_for_the_ThinkPad_T400&amp;diff=44824"/>
		<updated>2009-11-24T10:27:00Z</updated>

		<summary type="html">&lt;p&gt;Kiraven: /* Distro specific instructions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Specific installation notes for the ThinkPad {{T400}}.&lt;br /&gt;
&lt;br /&gt;
==General Notes==&lt;br /&gt;
&lt;br /&gt;
==Distro specific instructions==&lt;br /&gt;
&lt;br /&gt;
*[[Install Ubuntu 8.10 (Intrepid Ibex) on a ThinkPad T400]]&lt;br /&gt;
&lt;br /&gt;
*[[Install Ubuntu 9.04 (Jaunty Jackalope) on a ThinkPad T400]]&lt;br /&gt;
&lt;br /&gt;
*[[Install Ubuntu 9.10 (Karmic Koala) on a ThinkPad T400]]&lt;br /&gt;
&lt;br /&gt;
==External Sources==&lt;br /&gt;
&lt;br /&gt;
* [https://wiki.debian.org/InstallingDebianOn/Thinkpad/T400/lenny Debian/Lenny on ThinkPad T400]&lt;br /&gt;
&lt;br /&gt;
* [http://clemensfam.org/john/?p=42 &amp;quot;Mostly Harmless Blog - Ubuntu 8.10 T400 install tips&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
* [http://sudan.ubuntuforums.com/showthread.php?t=941792 &amp;quot;Using HDMI interface with ati card and fgrlx on linux&amp;quot;]&lt;/div&gt;</summary>
		<author><name>Kiraven</name></author>
		
	</entry>
	<entry>
		<id>https://www.thinkwiki.org/w/index.php?title=Installation_instructions_for_the_ThinkPad_T400&amp;diff=44469</id>
		<title>Installation instructions for the ThinkPad T400</title>
		<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/w/index.php?title=Installation_instructions_for_the_ThinkPad_T400&amp;diff=44469"/>
		<updated>2009-10-08T16:31:17Z</updated>

		<summary type="html">&lt;p&gt;Kiraven: /* Distro specific instructions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Specific installation notes for the ThinkPad {{T400}}.&lt;br /&gt;
&lt;br /&gt;
==General Notes==&lt;br /&gt;
&lt;br /&gt;
==Distro specific instructions==&lt;br /&gt;
&lt;br /&gt;
*[[Install Ubuntu 8.10 (Intrepid Ibex) on a ThinkPad T400]]&lt;br /&gt;
&lt;br /&gt;
*[[Install Ubuntu 9.04 (Jaunty Jackalope) on a ThinkPad T400]]&lt;br /&gt;
&lt;br /&gt;
*[[Install Ubuntu 9.10 (Karmic Koala) on a ThinkPad T400s]]&lt;br /&gt;
&lt;br /&gt;
==External Sources==&lt;br /&gt;
&lt;br /&gt;
* [https://wiki.debian.org/InstallingDebianOn/Thinkpad/T400/lenny Debian/Lenny on ThinkPad T400]&lt;br /&gt;
&lt;br /&gt;
* [http://clemensfam.org/john/?p=42 &amp;quot;Mostly Harmless Blog - Ubuntu 8.10 T400 install tips&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
* [http://sudan.ubuntuforums.com/showthread.php?t=941792 &amp;quot;Using HDMI interface with ati card and fgrlx on linux&amp;quot;]&lt;/div&gt;</summary>
		<author><name>Kiraven</name></author>
		
	</entry>
	<entry>
		<id>https://www.thinkwiki.org/w/index.php?title=Script_for_theft_alarm_using_HDAPS&amp;diff=43825</id>
		<title>Script for theft alarm using HDAPS</title>
		<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/w/index.php?title=Script_for_theft_alarm_using_HDAPS&amp;diff=43825"/>
		<updated>2009-08-06T10:54:40Z</updated>

		<summary type="html">&lt;p&gt;Kiraven: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==General==&lt;br /&gt;
&lt;br /&gt;
Recent ThinkPad models include a built-in two-axis accelerometer, as part of the [[HDAPS]] feature. This accelerometer can be put to another use: as a laptop theft deterrent. The following scripts detect when the laptop is moved, and emits a loud audio alarm. &lt;br /&gt;
&lt;br /&gt;
This alarm can be an effective deterrent against a casual laptop-snatcher in a populated environment (e.g., typical office space). It's also useful when you're across the room from the laptop and want to know if someone fiddles with it.&lt;br /&gt;
&lt;br /&gt;
Note that the alarm is disabled when the laptop is suspended or powered off. You can buy external (hardware) motion detector alarms to handle those cases.&lt;br /&gt;
&lt;br /&gt;
{{WARN|The audio alarm is played at a very high volume. Never enable the alarm while wearing headphones connected to the laptop's speaker output or when the laptop is connected to a high-power amplifier.}}&lt;br /&gt;
&lt;br /&gt;
==A comprehensive script==&lt;br /&gt;
&lt;br /&gt;
This Perl script periodically samples the tilt data reported by the accelerometer, computes the variance over recent samples, and triggers the alarm when the variance exceeds a given threshold.&lt;br /&gt;
&lt;br /&gt;
On a ThinkPad with [[Active Protection System]] running a modern Linux installation with the [[HDAPS|hdaps]] kernel module loaded, the script should work as is. Just run {{cmdroot|tp-theft --arm}} and see (or rather, hear) what happens when you tilt your laptop. &lt;br /&gt;
&lt;br /&gt;
The volume and alarm sound can be adjusted at the top of the script. On a ThinkPad {{T43}}, the synthetic siren at &amp;lt;tt&amp;gt;$alarm_volume=100&amp;lt;/tt&amp;gt; (up from the default 70) is quite ear-splitting, and combined with &amp;lt;tt&amp;gt;$acpi_volume=15&amp;lt;/tt&amp;gt; it is dangerously loud.&lt;br /&gt;
&lt;br /&gt;
The script is designed to run continuously in the background, so by default the alarm will be activated only when the KDE screen saver is locked. If you you open the laptop lid (or press the lid button) shortly before or after the beginning of movement, the alarm will be suspended (except for a brief warning) and you will get a few seconds of grace to unlock the screen saver (preferably, [[How to enable the fingerprint reader|using the integrated fingerprint reader]]!). You can disable this functionality by passing the &amp;lt;tt&amp;gt;--arm&amp;lt;/tt&amp;gt; parameter, by setting &amp;lt;tt&amp;gt;$use_kde=0&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;$use_lid=0&amp;lt;/tt&amp;gt;, or by using the simpler script below.&lt;br /&gt;
&lt;br /&gt;
There is also an option to track a BlueTooth device (e.g., a mobile phone). In this case, the alarm is activated (and optionally, the KDE desktop is locked) whenever the device is turned off or too distant for a given period, and deactivated when the BlueTooth device is nearby. You need to provide the device's BD address. If both KDE screen saver and BlueTooth checking are enabled, then the alarm will be activated when *either* the screensaver is enabled or the BlueTooth device is amiss.&lt;br /&gt;
&lt;br /&gt;
===Prerequisites===&lt;br /&gt;
&lt;br /&gt;
* ThinkPad with [[Active Protection System]]&lt;br /&gt;
* [[HDAPS|hdaps]] kernel module loaded (included in kernel 2.6.14 and later)&lt;br /&gt;
* Optional: [[ibm-acpi|ibm_acpi]] module loaded with the &amp;lt;tt&amp;gt;experimental=1&amp;lt;/tt&amp;gt; parameter (included in kernel 2.6.14 and later; needed only for full volume control)&lt;br /&gt;
The following are included in all modern Linux distributions:&lt;br /&gt;
* ALSA sound system, &amp;lt;tt&amp;gt;alsactl&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;aplay&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;amixer&amp;lt;/tt&amp;gt; )&lt;br /&gt;
* &amp;lt;tt&amp;gt;sox&amp;lt;/tt&amp;gt; (SOund eXchange) sound utility&lt;br /&gt;
&lt;br /&gt;
===The script===&lt;br /&gt;
{{CodeRef|tp-theft}}&lt;br /&gt;
&lt;br /&gt;
==A basic script==&lt;br /&gt;
&lt;br /&gt;
This is a simpler version of the above script, which omits the fancier functionality such as KDE screensaver detection, lid detection and state machine.&lt;br /&gt;
&lt;br /&gt;
===Prerequisites===&lt;br /&gt;
&lt;br /&gt;
* ThinkPad with [[Active Protection System]]&lt;br /&gt;
* [[HDAPS|hdaps]] kernel module loaded (included in kernel 2.6.14 and later)&lt;br /&gt;
* &amp;lt;tt&amp;gt;aumix&amp;lt;/tt&amp;gt; mixer control utility (included in all modern Linux distributions)&lt;br /&gt;
* &amp;lt;tt&amp;gt;sox&amp;lt;/tt&amp;gt; (SOund eXchange) sound utility (included in all modern Linux distributions)&lt;br /&gt;
* in newer Versions of sox (e.g. shipped with current Ubuntu), the used parameters are no longer supported. You have to replace &amp;quot;-t nul /dev/null&amp;quot; with &amp;quot;-n&amp;quot; in line 19.&lt;br /&gt;
&lt;br /&gt;
===The script===&lt;br /&gt;
&lt;br /&gt;
{{CodeRef|tp-theft-basic}}&lt;br /&gt;
&lt;br /&gt;
==Ideas for improvement==&lt;br /&gt;
Features awaiting contribution:&lt;br /&gt;
&lt;br /&gt;
===Activation===&lt;br /&gt;
* Gnome and xscreensaver support (similarly to [http://fdd.com/software/radeon/lightwatch.pl lightwatch.pl]?)&lt;br /&gt;
* Monitor X server presence  and make noise on sudden X server shutdown (i.e. catch {{key|ctrl}}{{key|alt}}{{key|backspace}} events).&lt;br /&gt;
* Monitor AC power and take it into account for alarm activation -- thieves seldom carry a UPS.&lt;br /&gt;
* Don't arm the alarm if movement of similar magnitude was happening also before the screensaver was auto-locked (the owner might be in a moving vehicle, etc.).&lt;br /&gt;
* Disarm the alarm (or hold it off for a few seconds, as already implemented for lid open) based on voice/sound recognition using the built-in microphone.&lt;br /&gt;
* Use fingerprint reader to disarm the alarm.&lt;br /&gt;
&lt;br /&gt;
===Precaution===&lt;br /&gt;
* Disable the alarm when headphones are plugged in -- it may cause hearing damage (if the user ignores the initial warning), and won't be effective anyway. '''Can we detect whether the something is plugged into the headphones/line-out socket?'''&lt;br /&gt;
* Theft attempts may be accompanied by rough handling, especially when the siren kicks in. So when starting an alarm also park the disk heads. Release the parking when a key is pressed (according {{path|/sys/bus/platform/drivers/hdaps/hdaps/keyboard_activity}}) so that the login prompt can start up. This requires kernel support for disk head parking and queue freezing, currently developed for the (original) HDAPS functionality.&lt;br /&gt;
&lt;br /&gt;
===Indication===&lt;br /&gt;
* Use XOSD to ivisually ndicate state changes.&lt;br /&gt;
* Use TrayIcon to indicate state changes.&lt;br /&gt;
* Use Notifications to indicate state changes.&lt;br /&gt;
&lt;br /&gt;
===Lockdown===&lt;br /&gt;
* Disable the volume buttons when the script is running so that a thief can't just turn the volume down. (Not an issue when &amp;lt;tt&amp;gt;ibm_acpi&amp;lt;/tt&amp;gt; volume control is available - see [[#Prerequisites|Prerequisites]].)&lt;br /&gt;
* Disable suspend and powersaving measures when armed.&lt;br /&gt;
* Disable poweroff (to the extent possible) when armed - or at least use the two seconds the power button acpi function comes active before poweroff to make as much noise as possible (it may take a while for a casual thief to actully remove the battery).&lt;br /&gt;
&lt;br /&gt;
===Alert===&lt;br /&gt;
* Start out quietly, and increase siren duration and volume if movement persists. Reset after a period of no movement.&lt;br /&gt;
* Report theft via network (if you get a chance to):&lt;br /&gt;
**Check for presence of wired or open wireless network and connect if not already connected.&lt;br /&gt;
**Send eMail to email to sms gateway or use an online sms service.&lt;br /&gt;
**If builtin webcam is present, take shots and upload them to a server or send via email. (This could be activated over a reboot, so that even if the thief gets away with the laptop, it would still be somewhat traceable.)&lt;br /&gt;
**If WAN of GPS devices are present, use it to detect position to a web server.&lt;br /&gt;
* When the alarm is triggered, also show a visual warning on the display. Override screensaver/powersaving if necessary. I.e., inform the thief that the notebook has a power on password and is useless without it. (This can be done by selecting a dedicated screensaver for that purpose.)&lt;br /&gt;
* Eject optical drive to irritate and hence slow down the thief.&lt;br /&gt;
&lt;br /&gt;
===Other===&lt;br /&gt;
* Implement this functionality in the embedded controller, so that the alarm will work even when the laptop is suspended. It may be possible to do so without IBM/Lenovo's involvement, using the [http://forum.thinkpads.com/viewtopic.php?t=20958 embedded controller disassembly].&lt;br /&gt;
* On Ubuntu, some of the paths don't work. alsactl is in /sbin, not /usr/sbin, and pidof is in /bin, not /sbin. These probably shouldn't be hardcoded paths. (Fix: create symlinks)&lt;br /&gt;
&lt;br /&gt;
==Pitfalls (and solutions?)==&lt;br /&gt;
* The audible alarm can always be suppressed by plugging earphones into the audio-jack (could be dealt with if software override for the audio-jack diversion is possible).&lt;br /&gt;
* The power button can be held to hard poweroff the notebook (can be avoided by using usb/bluetooth detection, closing the lid and sounding alarm if lid is opened before the usb/bluetooth device is present).&lt;br /&gt;
* The thief can unplug the battery to hard poweroff the notebook (can't do anything about it, but to set the alarm settings so that it goes off quickly - i.e., when using bluetooth detection, disable grace-period if activated manually)&lt;br /&gt;
&lt;br /&gt;
==Another Script (plugin-based)==&lt;br /&gt;
there's another script with the same intention available at http://www.informatik.hu-berlin.de/~pilop/HOWTO_Gentoo_T43/#TheftAlarm&lt;br /&gt;
&lt;br /&gt;
it uses a plugin-architecture for different checks (HDAPS, ethernet, power, lid, ...)&lt;br /&gt;
&lt;br /&gt;
==Yet another script (python/gtk based)==&lt;br /&gt;
You can find yet another version of this script at&lt;br /&gt;
&lt;br /&gt;
http://r3blog.nl/index.php/thinkpad-theft&lt;br /&gt;
(source at https://bitbucket.org/trbs/thinkpad-theft/overview/)&lt;br /&gt;
&lt;br /&gt;
It has almost the same features as the comprehensive script above, with a few improvements. It uses dbus to query the screensaver status and gconf for storing configuration value. To improve the delay before the alarm sounds, it has a built-in wav player, and it opens the file-descriptor of the wav at startup time (thereby removing the need to spawn an application to play the alarm; imagine someone stealing your laptop while you're doing heavy disk io). Furthermore, it has a trayicon allowing you to manipulate most settings stored in gconf aswell as showing you the current status of the alarm. The 0.2 release features activation on missing presence of a bluetooth or usb device.&lt;br /&gt;
&lt;br /&gt;
There is a [https://bitbucket.org/trbs/thinkpad-theft/overview new repository] at BitBucket that has seen some patches to fix problems with the unstable dbus-screensaver api and more.&lt;br /&gt;
&lt;br /&gt;
==Conceptional thoughts==&lt;br /&gt;
The above feature improvement suggestions partly require the theft protection software to be running as root (ACPI and hardware management), partly to be running as user (DBus SessionBus communications). Hence the following approach would be the one opening for the most coverage:&lt;br /&gt;
*theft-protection-daemon; run as root by init; controlling config, system related activation, lockdown and alarm&lt;br /&gt;
*theft-protection-trayicon; run in user-session; reporting desktop related activation criteria to the daemon and giving visual user feedback on the desktop&lt;br /&gt;
*theft-protection-properties; runnable as user; reporting configuration changes to daemon&lt;br /&gt;
&lt;br /&gt;
Ideally, they would provide a plugin-system, with plugins consisting of a functional and a gui part.&lt;br /&gt;
With this scheme, the theft protection can't be circumvented i.e. by pressing {{key|ctrl}}{{key|alt}}{{key|backspace}}.&lt;br /&gt;
&lt;br /&gt;
[[Category:Scripts]]&lt;/div&gt;</summary>
		<author><name>Kiraven</name></author>
		
	</entry>
	<entry>
		<id>https://www.thinkwiki.org/w/index.php?title=Talk:Script_for_theft_alarm_using_HDAPS&amp;diff=43824</id>
		<title>Talk:Script for theft alarm using HDAPS</title>
		<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/w/index.php?title=Talk:Script_for_theft_alarm_using_HDAPS&amp;diff=43824"/>
		<updated>2009-08-06T10:48:58Z</updated>

		<summary type="html">&lt;p&gt;Kiraven: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Wonderful idea! And works perfectly on my T43p, scared the cat away. ;)&lt;br /&gt;
&lt;br /&gt;
--[[User:Spiney|spiney]] 20:35, 12 Nov 2005 (CET)&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Good, so it's at least a cat deterrant! A friend of mine had a nasty incident involving a laptop and a cat...&lt;br /&gt;
BTW, I'm the author (identifed by IP address again due the usual ThinkWiki autologin flakiness).&lt;br /&gt;
&lt;br /&gt;
--[[User:Thinker|Thinker]] 20:52, 12 Nov 2005 (CET)&lt;br /&gt;
----&lt;br /&gt;
I had to tweak the line that reads the position file. My position file has - numbers in it for some reason, so: &lt;br /&gt;
m/^\(-(\d+),-(\d+)\)$/ or die &amp;quot;Can't parse $pos_file content\n&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
After that change it works great. &lt;br /&gt;
It scared the dogs away here. ;) &lt;br /&gt;
--[[User:nirik|nirik]] 21:24, 12 Nov 2005 (CET)&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Fixed. Which ThinkPad model, BTW?&lt;br /&gt;
&lt;br /&gt;
--[[User:Thinker|Thinker]] 21:44, 12 Nov 2005 (CET)&lt;br /&gt;
----&lt;br /&gt;
Cool. Excellent. ;) &lt;br /&gt;
&lt;br /&gt;
T42p here. &lt;br /&gt;
&lt;br /&gt;
--[[User:Nirik|Nirik]] 21:45, 12 Nov 2005 (CET)&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
I love it!  Great contributions, Thinker!&lt;br /&gt;
&lt;br /&gt;
Of course, it is more proof-of-concept tough, as a thief can simply hit the &amp;quot;mute&amp;quot; button, or carry an old headphone plug with the actual headphones chopped off and stuff this quickly into the audio out jack.  Don't leave your laptop unattended :) :)&lt;br /&gt;
&lt;br /&gt;
--[[User:Gsmenden|Gsmenden]] 18:06, 28 Nov 2005 (CET)&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Thanks! About muting, I'm not sure the mute button will work (I reset the mixer volumes every second), but the thief can certainly power off, or suspend, or pull out the AC and battery. But my hope is that the casual, uninformed laptop-snatcher will trigger the alarm for at least a few seconds, and if you're just down the hall or there are other people nearby, that's probably enough to save your laptop. Not as good as a real lock+alarm, but better than nothing, and pretty convenient when autoactivated by the screensaver (&amp;lt;tt&amp;gt;$use_kde=1&amp;lt;/tt&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
--[[User:Thinker|Thinker]] 01:40, 29 Nov 2005 (CET)&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
someone asked if it's possible to watch out for gnome-screensaver.&lt;br /&gt;
- it is, using dbus-monitor (like explained on the gnome-screensaver faq page).&lt;br /&gt;
&lt;br /&gt;
the following perl script&lt;br /&gt;
&lt;br /&gt;
 my $cmd = &amp;quot;dbus-monitor --session \&amp;quot;type='signal',interface='org.gnome.ScreenSaver',member='SessionIdleChanged'\&amp;quot;&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
 open (IN,&amp;quot;-|&amp;quot;, &amp;quot;$cmd&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 while (&amp;lt;IN&amp;gt;) {&lt;br /&gt;
    if (m/^\s+boolean true/) {&lt;br /&gt;
        print &amp;quot;screensaver is now active&amp;quot;;&lt;br /&gt;
    } elsif (m/^\s+boolean false/) {&lt;br /&gt;
        print &amp;quot;screensaver is now inactive&amp;quot;;&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
will print when gnome-screensaver goes active&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The ugly part is &lt;br /&gt;
&lt;br /&gt;
1. You can only find out once gnome-screensaver is going active or inactive, but not if it's active when the scripts is started.&lt;br /&gt;
&lt;br /&gt;
2. I don't really know how to check if there is new output in &amp;lt;IN&amp;gt;, because something like my $cmdline=&amp;lt;IN&amp;gt;; will hang until there is new output (like when the screensaver is going (in)active).&lt;br /&gt;
&lt;br /&gt;
--[[User:Mcgiver|Mcgiver]] 20:35, 12 Nov 2005 (CET)&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
==Usefulness for head parking==&lt;br /&gt;
Works great. Maybe we can the script for testing the disk park patches by Jon Escombe &amp;lt;lists@dresco.co.uk&amp;gt;&lt;br /&gt;
-- [[User:Ozi23]]&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
You can use it for testing, but note that the specific algorithm used in this script (threshold on standard deviation of samples during last second) is optimized for the theft deterrent situation. It is highly unsuitable for the head parking application, since it reacts too slowly -- by the it will recognize the movement, the disk heads will have already crashed. For head parking you'd need a low-latency algorithm, and preferably an in-kernel implementation to allow frequeny low-overhead polling, reduce latencies, and avoid accidentally spinning the disk ''up'' when loading or swapping in userspace stuff needed to spin the disk ''down''.&lt;br /&gt;
&lt;br /&gt;
--[[User:Thinker|Thinker]] 20:20, 14 Nov 2005 (CET)&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
It's even worse that I thought. Check out the [ftp://ftp.software.ibm.com/pc/pccbbs/mobiles_pdf/aps2mst.pdf IBM white paper] - there's barely enough time to park the head, so in the Windows driver they're using some pretty fancy learning algorithm to deduce when movement deviates from &amp;quot;normal&amp;quot;, to decide when to redefine &amp;quot;normal&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
--[[User:Thinker|Thinker]] 19:08, 22 Nov 2005 (CET)&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Good news every one ..... &lt;br /&gt;
Just kidding. I've found the hdapsd package which acts as a deamon for the hdaps and uses the kernel patch by Jon Escombe. I havent tested it but some people   &lt;br /&gt;
were able to get the protection system work. It seems to depend on the firmware of the harddrive. Its in early stage so be carefull.&lt;br /&gt;
&lt;br /&gt;
http://lwn.net/Articles/154923/ (kernel patch)&lt;br /&gt;
http://bugs.gentoo.org/show_bug.cgi?id=100167 (hdapsd)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Minor modifications ==&lt;br /&gt;
&lt;br /&gt;
tp-theft.pl v0.33 is working fine here, but I have modified some parts:&lt;br /&gt;
* I made a change for kdesktop_lock since it is located in /usr/kde/&amp;lt;kde-version&amp;gt;/bin/ here (Gentoo-specific)&lt;br /&gt;
* I removed the check wether kdesktop is running. I start tp-theft.pl via inittab which will be up before I have logged in&lt;br /&gt;
&lt;br /&gt;
-- satmd, 2005-12-25&lt;br /&gt;
&lt;br /&gt;
What's Gentoo's way of finding out the KDE path? I suppose&lt;br /&gt;
 my $bin = `which kdesktop_lock`;&lt;br /&gt;
won't work from an initscript because the PATH is not set up yet.&lt;br /&gt;
&lt;br /&gt;
--[[User:Thinker|Thinker]] 23:38, 25 Dec 2005 (CET)&lt;br /&gt;
&lt;br /&gt;
With Gentoo&lt;br /&gt;
 /usr/bin/env kde-config --exec-prefix --expandvars&lt;br /&gt;
returns /usr/kde/3.5 . That looks general useable to me.&lt;br /&gt;
I do not use an initscript, but inittab&lt;br /&gt;
... with initscripts one could easily source /etc/profile or something.&lt;br /&gt;
&lt;br /&gt;
-- satmd, 2005-12-25&lt;br /&gt;
&lt;br /&gt;
Will an inittab script find &amp;lt;tt&amp;gt;kde-config&amp;lt;/tt&amp;gt;, which is probably in {{path|/usr/kde/&amp;lt;kde-version&amp;gt;/bin/}} too? And if so, won't &amp;lt;tt&amp;gt;which kdedesktop_lock&amp;lt;/tt&amp;gt; also work?&lt;br /&gt;
&lt;br /&gt;
--[[User:Thinker|Thinker]] 00:56, 26 Dec 2005 (CET)&lt;br /&gt;
&lt;br /&gt;
Did not work - both of them. Keeping my hardcoded value.&lt;br /&gt;
-- satmd, 2005-12-26 06:09 CET&lt;br /&gt;
&lt;br /&gt;
== Is there a way do make something like this work on Windows? ==&lt;br /&gt;
&lt;br /&gt;
see topic.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
theoretically speaking yes, since the accelerometer must be readable in windows too.&lt;br /&gt;
&lt;br /&gt;
But I doubt there is an easy way to find out how to read it.&lt;br /&gt;
&lt;br /&gt;
You might want to decompile the ibm hdaps active protection script to find out.&lt;br /&gt;
&lt;br /&gt;
--[[User:Mcgiver|Mcgiver]] 20:35, 12 Nov 2005 (CET)&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Debian/Ubuntu libsox dependencies ==&lt;br /&gt;
&lt;br /&gt;
Just a little Debian/Ubuntu heads-up:&lt;br /&gt;
&lt;br /&gt;
If you get this error:&lt;br /&gt;
&lt;br /&gt;
''sox soxio: Can't open output file `/dev/dsp': unknown file type `ossdsp'''&lt;br /&gt;
&lt;br /&gt;
...then try installing '''libsox-fmt-oss'''.  This fixed the problem for me, on Debian Etch.  I based this info off of an Ubuntu forum post... different problem, but the same error message:&lt;br /&gt;
http://ubuntuforums.org/showthread.php?t=740612&lt;br /&gt;
&lt;br /&gt;
--[[User:ashank|Andy Shank]] 14:38, 13 Oct 2008 (MST)&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== New Sox Version? ==&lt;br /&gt;
&lt;br /&gt;
I got this error&lt;br /&gt;
&lt;br /&gt;
''sox formats: no handler for given file type `nul'''&lt;br /&gt;
&lt;br /&gt;
with current sox 14.2.0 in Debian unstable.&lt;br /&gt;
&lt;br /&gt;
Replacing ''-t nul /dev/null'' with ''-t'' fixed it for me.&lt;br /&gt;
I'm not changing the script because I guess the majority is still using older sox.&lt;br /&gt;
&lt;br /&gt;
--[[User:Defiant|Defiant]] 18:25, 23 April 2009 (UTC)&lt;br /&gt;
&lt;br /&gt;
I have the same problem, but I don't understand your fix. ''sox -t  -t ossdsp /dev/dsp synth 1.0 sine 2000-4000 sine 4000-2000&lt;br /&gt;
''→ ''sox formats: no handler for given file type `-t''&lt;br /&gt;
[[User:Kiraven|Kiraven]] 15:23, 1 May 2009 (UTC)&lt;br /&gt;
&lt;br /&gt;
Any solution to this problem?&lt;br /&gt;
&lt;br /&gt;
[[User:sigurd|sigurd]] 18:00, 19 May 2009 (UTC)&lt;br /&gt;
&lt;br /&gt;
I replaced ''-t nul /dev/null'' with ''-n'', now, it's working. --[[User:Kiraven|Kiraven]] 10:48, 6 August 2009 (UTC)&lt;/div&gt;</summary>
		<author><name>Kiraven</name></author>
		
	</entry>
	<entry>
		<id>https://www.thinkwiki.org/w/index.php?title=Talk:Script_for_theft_alarm_using_HDAPS&amp;diff=43101</id>
		<title>Talk:Script for theft alarm using HDAPS</title>
		<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/w/index.php?title=Talk:Script_for_theft_alarm_using_HDAPS&amp;diff=43101"/>
		<updated>2009-05-01T15:23:33Z</updated>

		<summary type="html">&lt;p&gt;Kiraven: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Wonderful idea! And works perfectly on my T43p, scared the cat away. ;)&lt;br /&gt;
&lt;br /&gt;
--[[User:Spiney|spiney]] 20:35, 12 Nov 2005 (CET)&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Good, so it's at least a cat deterrant! A friend of mine had a nasty incident involving a laptop and a cat...&lt;br /&gt;
BTW, I'm the author (identifed by IP address again due the usual ThinkWiki autologin flakiness).&lt;br /&gt;
&lt;br /&gt;
--[[User:Thinker|Thinker]] 20:52, 12 Nov 2005 (CET)&lt;br /&gt;
----&lt;br /&gt;
I had to tweak the line that reads the position file. My position file has - numbers in it for some reason, so: &lt;br /&gt;
m/^\(-(\d+),-(\d+)\)$/ or die &amp;quot;Can't parse $pos_file content\n&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
After that change it works great. &lt;br /&gt;
It scared the dogs away here. ;) &lt;br /&gt;
--[[User:nirik|nirik]] 21:24, 12 Nov 2005 (CET)&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Fixed. Which ThinkPad model, BTW?&lt;br /&gt;
&lt;br /&gt;
--[[User:Thinker|Thinker]] 21:44, 12 Nov 2005 (CET)&lt;br /&gt;
----&lt;br /&gt;
Cool. Excellent. ;) &lt;br /&gt;
&lt;br /&gt;
T42p here. &lt;br /&gt;
&lt;br /&gt;
--[[User:Nirik|Nirik]] 21:45, 12 Nov 2005 (CET)&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
I love it!  Great contributions, Thinker!&lt;br /&gt;
&lt;br /&gt;
Of course, it is more proof-of-concept tough, as a thief can simply hit the &amp;quot;mute&amp;quot; button, or carry an old headphone plug with the actual headphones chopped off and stuff this quickly into the audio out jack.  Don't leave your laptop unattended :) :)&lt;br /&gt;
&lt;br /&gt;
--[[User:Gsmenden|Gsmenden]] 18:06, 28 Nov 2005 (CET)&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Thanks! About muting, I'm not sure the mute button will work (I reset the mixer volumes every second), but the thief can certainly power off, or suspend, or pull out the AC and battery. But my hope is that the casual, uninformed laptop-snatcher will trigger the alarm for at least a few seconds, and if you're just down the hall or there are other people nearby, that's probably enough to save your laptop. Not as good as a real lock+alarm, but better than nothing, and pretty convenient when autoactivated by the screensaver (&amp;lt;tt&amp;gt;$use_kde=1&amp;lt;/tt&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
--[[User:Thinker|Thinker]] 01:40, 29 Nov 2005 (CET)&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
someone asked if it's possible to watch out for gnome-screensaver.&lt;br /&gt;
- it is, using dbus-monitor (like explained on the gnome-screensaver faq page).&lt;br /&gt;
&lt;br /&gt;
the following perl script&lt;br /&gt;
&lt;br /&gt;
 my $cmd = &amp;quot;dbus-monitor --session \&amp;quot;type='signal',interface='org.gnome.ScreenSaver',member='SessionIdleChanged'\&amp;quot;&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
 open (IN,&amp;quot;-|&amp;quot;, &amp;quot;$cmd&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 while (&amp;lt;IN&amp;gt;) {&lt;br /&gt;
    if (m/^\s+boolean true/) {&lt;br /&gt;
        print &amp;quot;screensaver is now active&amp;quot;;&lt;br /&gt;
    } elsif (m/^\s+boolean false/) {&lt;br /&gt;
        print &amp;quot;screensaver is now inactive&amp;quot;;&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
will print when gnome-screensaver goes active&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The ugly part is &lt;br /&gt;
&lt;br /&gt;
1. You can only find out once gnome-screensaver is going active or inactive, but not if it's active when the scripts is started.&lt;br /&gt;
&lt;br /&gt;
2. I don't really know how to check if there is new output in &amp;lt;IN&amp;gt;, because something like my $cmdline=&amp;lt;IN&amp;gt;; will hang until there is new output (like when the screensaver is going (in)active).&lt;br /&gt;
&lt;br /&gt;
--[[User:Mcgiver|Mcgiver]] 20:35, 12 Nov 2005 (CET)&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
==Usefulness for head parking==&lt;br /&gt;
Works great. Maybe we can the script for testing the disk park patches by Jon Escombe &amp;lt;lists@dresco.co.uk&amp;gt;&lt;br /&gt;
-- [[User:Ozi23]]&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
You can use it for testing, but note that the specific algorithm used in this script (threshold on standard deviation of samples during last second) is optimized for the theft deterrent situation. It is highly unsuitable for the head parking application, since it reacts too slowly -- by the it will recognize the movement, the disk heads will have already crashed. For head parking you'd need a low-latency algorithm, and preferably an in-kernel implementation to allow frequeny low-overhead polling, reduce latencies, and avoid accidentally spinning the disk ''up'' when loading or swapping in userspace stuff needed to spin the disk ''down''.&lt;br /&gt;
&lt;br /&gt;
--[[User:Thinker|Thinker]] 20:20, 14 Nov 2005 (CET)&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
It's even worse that I thought. Check out the [ftp://ftp.software.ibm.com/pc/pccbbs/mobiles_pdf/aps2mst.pdf IBM white paper] - there's barely enough time to park the head, so in the Windows driver they're using some pretty fancy learning algorithm to deduce when movement deviates from &amp;quot;normal&amp;quot;, to decide when to redefine &amp;quot;normal&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
--[[User:Thinker|Thinker]] 19:08, 22 Nov 2005 (CET)&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Good news every one ..... &lt;br /&gt;
Just kidding. I've found the hdapsd package which acts as a deamon for the hdaps and uses the kernel patch by Jon Escombe. I havent tested it but some people   &lt;br /&gt;
were able to get the protection system work. It seems to depend on the firmware of the harddrive. Its in early stage so be carefull.&lt;br /&gt;
&lt;br /&gt;
http://lwn.net/Articles/154923/ (kernel patch)&lt;br /&gt;
http://bugs.gentoo.org/show_bug.cgi?id=100167 (hdapsd)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Minor modifications ==&lt;br /&gt;
&lt;br /&gt;
tp-theft.pl v0.33 is working fine here, but I have modified some parts:&lt;br /&gt;
* I made a change for kdesktop_lock since it is located in /usr/kde/&amp;lt;kde-version&amp;gt;/bin/ here (Gentoo-specific)&lt;br /&gt;
* I removed the check wether kdesktop is running. I start tp-theft.pl via inittab which will be up before I have logged in&lt;br /&gt;
&lt;br /&gt;
-- satmd, 2005-12-25&lt;br /&gt;
&lt;br /&gt;
What's Gentoo's way of finding out the KDE path? I suppose&lt;br /&gt;
 my $bin = `which kdesktop_lock`;&lt;br /&gt;
won't work from an initscript because the PATH is not set up yet.&lt;br /&gt;
&lt;br /&gt;
--[[User:Thinker|Thinker]] 23:38, 25 Dec 2005 (CET)&lt;br /&gt;
&lt;br /&gt;
With Gentoo&lt;br /&gt;
 /usr/bin/env kde-config --exec-prefix --expandvars&lt;br /&gt;
returns /usr/kde/3.5 . That looks general useable to me.&lt;br /&gt;
I do not use an initscript, but inittab&lt;br /&gt;
... with initscripts one could easily source /etc/profile or something.&lt;br /&gt;
&lt;br /&gt;
-- satmd, 2005-12-25&lt;br /&gt;
&lt;br /&gt;
Will an inittab script find &amp;lt;tt&amp;gt;kde-config&amp;lt;/tt&amp;gt;, which is probably in {{path|/usr/kde/&amp;lt;kde-version&amp;gt;/bin/}} too? And if so, won't &amp;lt;tt&amp;gt;which kdedesktop_lock&amp;lt;/tt&amp;gt; also work?&lt;br /&gt;
&lt;br /&gt;
--[[User:Thinker|Thinker]] 00:56, 26 Dec 2005 (CET)&lt;br /&gt;
&lt;br /&gt;
Did not work - both of them. Keeping my hardcoded value.&lt;br /&gt;
-- satmd, 2005-12-26 06:09 CET&lt;br /&gt;
&lt;br /&gt;
== Is there a way do make something like this work on Windows? ==&lt;br /&gt;
&lt;br /&gt;
see topic.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
theoretically speaking yes, since the accelerometer must be readable in windows too.&lt;br /&gt;
&lt;br /&gt;
But I doubt there is an easy way to find out how to read it.&lt;br /&gt;
&lt;br /&gt;
You might want to decompile the ibm hdaps active protection script to find out.&lt;br /&gt;
&lt;br /&gt;
--[[User:Mcgiver|Mcgiver]] 20:35, 12 Nov 2005 (CET)&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Debian/Ubuntu libsox dependencies ==&lt;br /&gt;
&lt;br /&gt;
Just a little Debian/Ubuntu heads-up:&lt;br /&gt;
&lt;br /&gt;
If you get this error:&lt;br /&gt;
&lt;br /&gt;
''sox soxio: Can't open output file `/dev/dsp': unknown file type `ossdsp'''&lt;br /&gt;
&lt;br /&gt;
...then try installing '''libsox-fmt-oss'''.  This fixed the problem for me, on Debian Etch.  I based this info off of an Ubuntu forum post... different problem, but the same error message:&lt;br /&gt;
http://ubuntuforums.org/showthread.php?t=740612&lt;br /&gt;
&lt;br /&gt;
--[[User:ashank|Andy Shank]] 14:38, 13 Oct 2008 (MST)&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== New Sox Version? ==&lt;br /&gt;
&lt;br /&gt;
I got this error&lt;br /&gt;
&lt;br /&gt;
''sox formats: no handler for given file type `nul'''&lt;br /&gt;
&lt;br /&gt;
with current sox 14.2.0 in Debian unstable.&lt;br /&gt;
&lt;br /&gt;
Replacing ''-t nul /dev/null'' with ''-t'' fixed it for me.&lt;br /&gt;
I'm not changing the script because I guess the majority is still using older sox.&lt;br /&gt;
&lt;br /&gt;
--[[User:Defiant|Defiant]] 18:25, 23 April 2009 (UTC)&lt;br /&gt;
&lt;br /&gt;
I have the same problem, but I don't understand your fix. ''sox -t  -t ossdsp /dev/dsp synth 1.0 sine 2000-4000 sine 4000-2000&lt;br /&gt;
''→ ''sox formats: no handler for given file type `-t''&lt;br /&gt;
[[User:Kiraven|Kiraven]] 15:23, 1 May 2009 (UTC)&lt;/div&gt;</summary>
		<author><name>Kiraven</name></author>
		
	</entry>
</feed>