Tag: lenny

Bluetooth presence detection

Posted by – 27/12/2008

This is the follow-up on my Asus EEE PC configuration. Next on my TODO list was to make the webcam work, and as Ben Armstrong had pointed it worked fairly well, proving to be a non-issue.

After that, I decided it would be a good thing if the presence of my bluetooth-enabled cellphone were tested, so that if I walk away from the PC, it called xscreensaver -lock. After some googling, I found a tool that did just that: BlueProximity. It really seemed a good idea, except that my cellphone (a Palm Treo 650) kept warning me about a connection going on, which was quite unpleasant. This happens because BlueProximity tests the RSSI of a bluetooth connection… Beautiful, but a little overkill for what I wanted: I just wanted to know if it is there or not.

First I tested the bluetooth discovery with hcitool scan, but for that I would have to keep my cellphone Discovery On, which is not a smart thing to do… So I tested other things, and found out that hcitool name XX:XX:XX:XX:XX:XX only returned the name of my cellphone if it were around. So that was what I used. This is treo-presence.sh script:

CMD="/usr/bin/hcitool name $TREO"
if [ "`$CMD`" = "$NAME" ]; then
  exit 1
exit 0

It returns 0 or 1 if the TREO device is absent or present, respectively. I use it from the following cron script:

/usr/bin/w | /bin/grep $LOGNAME > /dev/null 2>&1
if [ $? -ne 0 ]; then
  # Running user is not logged in
  exit 1
LOCK_CMD="/usr/bin/xscreensaver-command -lock"
/bin/touch $FILE
/usr/bin/tail -2 $FILE > $TMPFILE
$CMD; echo $? >> $TMPFILE
/bin/mv $TMPFILE $FILE
/bin/rm -f $TMPFILE
for line in `cat $FILE`; do
  if [ "$line" = "1" ]; then
    exit 1
# Got here: all 3 lines are not 1
$LOCK_CMD > /dev/null 2>&1
exit 0

This is run from the user crontab file every minute, recording the last 3 runs in a file in /tmp. If all 3 runs indicates the absence of my cellphone, xscreensaver -lock is called. Simple enough and doesn’t give me connection warnings in my Treo.

Other approaches are surely possible. Also, I am not sure treo-presence.sh would work for other devices… This is just what works for me…

Lenny in the Asus EEE PC 901 – day 2

Posted by – 18/12/2008

Really, now is the day 3… I am just considering this day 2 for I had to do a lot of things again due to my dumbness. Let me explain:

I had a desktop environment in place (with fluxbox), wired network, and most of my daily softwares (Iceweasel, X-Chat, Pidgin, GkRellM), then I decided to test the Suspend-to-Disk… At first, it seemed to work well: I made a swap file for uswsusp, just as documented… what is not documented is that this file must be outside the encrypted partition!

So, when I turned it on again, an error telling me about some corruption in the opened luks partition. I though “OK, something gone mad, just a matter of running an e2fsck”. So I booted with the netinst pendrive, opened the luks partition and ran it with -y. Everything seemed to be corrupted!!! It spend almost 5 minutes fixing bogus inodes and stuff before I decided to interrupt the process… this “fixed” filesystem would never work anyway.

So I began from scratch… All over again. When I got into a working base-system, some other thought stroke me: what if Brenda were to use rohan (have I mentioned the name is rohan? I name all my machines after places in Middle-earth)? So, a minimal “user-friendly” desktop is needed… After some research, I decided to go for LXDE. This is a minimalist desktop with OpenBox as the window-manager. I’ve been using FluxBox for a long time now, so running another BlackBox-based would not be such a problem.

LXDE is quite good. So far, everything I expected is working fine….

Then I decided it’s time to move on to configure the Wi-Fi stuff. I installed the RT2860 modules from Debian/EEEPC Repository and added rt2860sta to /etc/modules. At first I was worried that some reports of it not working with WEP showed up in a Google Search… But nothing could be smoother! I installed wicd and it detected our WEP AP like a charm (and a bunch of other APs nearby)… after entering our key it just connected fine and I’ve been using it since… no glitches so far.

I would like to play a little more, but I called the day since I got a lot of work going on… Next item planned is the webcam…

Lenny in the Asus EEE PC 901 – day 1

Posted by – 16/12/2008

Following my previous post, today I began to turn my brand new Asus EEE PC 901 into a Debian Machine. At first I wanted to do all in one day, but since work is taking too much out of me (and everything seems to take more time than expected), I’ll have to split this in different days…

So, first things first. I read Debian Wiki on the issue and began by doing the most important: backing it up. So I got a daily netinst iso, put it on a USB Pendrive and followed the tip on backup over the network using netcat. Easy and effective, and took only 8 minutes on the 901 (I think the 35 minutes described on the wiki were for models with slower NICs).

From there, I had to decide which version of the installer I’d use. I chose Standard, since I want an encrypted disk on my EEE. So I run the installer and, on the partition manager, I deleted /dev/sda1 (where Xandros was installed), turning it into a 300 MB /dev/sda5 (to use as /boot) and a 3 GB /dev/sda6 building a Logical Volume over an LVM Volume Group with it and /dev/sdb1 (where the user directory was), and enciphering it. This took a long time, since, I believe, random data were being written to the device to increase crypto strength. I left /dev/sda{2,3,4} as they were, since they can belong to the Asus EEE Recovering System (and they don’t take too much space ­čÖé )

Now base system is installed, and wired network works like a charm… Next steps will have to wait until tomorrow.