Tuesday 17 January 2006

Sweet KDE file views

Take a look at this KDE4 screenshot.

It looks like it merges the GNOME button address bar AND the old typeable address bar. Sweet! Just what I wanted!

The whole lot of screenshots look amazing. Usually such screenshots are more a way to show off wallpaper that the GUI, but KDE4 makes me say I want it.

I tried KDE3 over GNOME, but the blinding appearance overcame the lack of usability in GNOME, so I stuck with GNOME. I can’t exmaplin what is wrong with KDE3 look and feel that is fine with GNOME, although I can say it isn’t the paucity (lack) of being able to do things in general with GNOME.

Another annoyance with GNOME. I want to turn off my grid for my desktop layout but not for folder layouts, and I want the default view for lots of folders or non-image files to be list view.

Friday 13 January 2006

Prank Callers Revenge Complete

Here is the final part on how I got my modem to automatically answer and drop phone calls from certain numbers that had been troubling me.

My Intel 536EP is famous for not supporting CLI, and slightly famous for the odd Intel engineer saying it does support CLI. No-one in the world has made it work.

Luckily, my sister in law returned my USR 56K external modem on Sunday, so I stick that in ttyS0 and remove the graphics stylus I wasn’t using anyway. This modem gives no problem recognizing CLI.

I decide to write my CLI Dropper in bash, for fun, and get more grief then you could imagine. It sounds easy, a quick stty, echo a few strings to the modem port and then enter a while loop to read back the response. Sadly bash’s bufferred IO reads too much (naturally) but then tries to put back the extra stuff using seek on a pipe. Well! This fails on a tty, and so lots of the output gets lost. It took me quite a while and use of strace to work this out.

Instead now, I use cat to pipe the output of the modem into a bash segment. Because cat is reading from a tty it is unbufferred, but also bash’s seek works, so everything is fine.

cat /dev/ttyS0 | while read line 

So now I just keep a list of banned phone numbers in /etc/clidrop. Banned callers get treated to about 5 seconds of modem noise before getting hung up on. All calls are logged in /var/log/messages, so I can look back and see what went on.

Here is my shell script, complete and tested:

#! /bin/sh

: ${MODEM:=/dev/ttyS0}

# modem on stdout
exec > "$MODEM"
stty igncr 38400 min 1 time 5 ignbrk -brkint -icrnl -imaxbel -opost -onlcr -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke < $MODEM

send() {
  echo -ne "$*\r"

command() {
  send "$*"
  echo ">$*" >&2
  read response
  test "$response" == "$*" && read response
  echo "<$response" >&2

checkNumber() {
  echo "Check $1" >&2
  grep "^$1\%CONTENT%quot; /etc/clidrop &> /dev/null

# nasty cat hack cos bash "read" can’t unread extra lines from a tty
# but cat doesn’t buffer if it reads from a tty
cat "$MODEM" | (
command "AT S7=45 S0=0 L1 V1 X4 &c1 E1 Q0"
command "ATL0M0" # turn of speaker
command "AT#CID=1"

while read -s response
  case "$response" in
    "NMBR = "*)
      NUMBER="`expr "$response" : ‘NMBR = \(.*\)’`"
      if checkNumber "$NUMBER"
        logger -t CLIDROP "Drop call from $NUMBER"
        echo "<$response DENIED" >&2
        send ATA
        sleep 5
        send ""
        logger -t CLIDROP "Permit call from $NUMBER"
        echo "<$response PERMITTED" >&2
    *) echo "<$response" >&2;;

My /etc/clidrop file is has these numbers in:

Why does bash try to seek on input stream after a read? It’s so that it can pretent that it did not read more than it returned, and then any internal or external commands spawned will be able to get stdin from that point. Of course such external commands are not so nice, sed …/q will have slurped more of stdin than it ought to and so some of the remainder won’t be available to the calling bash script; so why is bash trying to be nice? Ah well… it’s what comes of pretending that a collection of commands and bash are a homogenous programming environment like perl.

Saturday 7 January 2006

Prank callers revenge

I mentioned previously that I got Caller-ID (or CLI) enabled on my line because of prank calls, or more likely, a broken call centre dialler.

As I expected, knowing who is calling doesn’t stop them calling, it just gives me a strong hint as to whether or not the caller will hangup as soon as I answer.
In the UK, CLI is passed before the first ring; so with a bit of cunning I should be able to get my PC to answer and hangup on these idiots without even disturbing me!

Time to try and get my built-in modem working under linux. I’m very pleased with my PC, it’s a Medion brand from Toys-R-US who for a long time know have done the best value PC’s, followed closely by ALDI. A bit of help from the scanModem utility at http://linmodems.technion.ac.il/ identifies my modem as being based on the intel 536EP chipset. It’s hard to get up-to-date drivers that compile and work, but this message led me to what appears to be a hidden intel download of version 4.71 hurrah; that works, although make-install fails, so I have to do a few copies by hand (boo, hiss). As far as I can tell AT+VCID=1 will turn on CLI, te rest can be done with a bash script, but first I need to set up a phone extension cable…

My ADSL modem is in a different room to my PC, I don’t have a convenient phone socket near my PC, but I do have some CAT5e network cable from my ADSL modem to my PC, so I can use the two spare CAT5 pairs to carry the phone signal. I take a modem cable and cut it in half and attach an RJ45 network connector to the cut ends. I can now transfer my phone line over my network cable. As I only have one network cable and I’m already using it, I borrow a couple of network economizers like this from work; they are a sort of Y junction that map the regular UTP network pins on one socket to the spare strands in the cable so you can carry two network connections over one cable.

I’ll probably use my new phone/network cable to allow me to put my ADSL modem next to my computer and take the splitters back to work.

Thursday 5 January 2006

Prank Callers

Recently, twice a day my home telephone is called by 0141 301 8000. When I answer, the caller hangs up, and if I return the call they hang up immediately.

0141 is a Glasgow area code, home to many call centres (bless them) and I suspect one me these is home to a rouge dialer, either that or they don’t have enough staff to take my call when I answer. However, nigh on twice a day for a week is too much, and my guess about a call centre might even bestow too much legitimacy to the incidents. Something must be done.

Treating the whole thing as maliciously executed by an unknown human, I call my BT operator to see what remedies they offer these days. Without the need to speak to a human, I am directed to call 0800 661441 where I am entertained with useful and practical ways to deal with prank callers. Finally, the robot voice offers me free caller ID if I take it at the same time as BT register my number with the telephone preference service, (which they also offer to do).

Bargain! So I can’t stop the calls, but I can avoid answering to those idiots, and I get caller ID as sort of compensation - with a marginal cost to BT of nill, and without them even needing to involve any expensive customer service call handlers. Big wins all round, them. Oh, apart from the call centres who will have to stop calling me in 28 days, thanks to the idiots behind 0141 3018000.