Ting Stick Udev Support
Tim Sander <[email protected]>
| Newsgroups | gmane.linux.hotplug.devel |
|---|---|
| Message-ID | <6549306.UZb6P8InKs@virgo> |
Hi Attached are two files which enable the basic functionality to use a Ting-Stick with Linux. They read out the TDB.TXT file which contains the book nrs and downloads the coressponding files and clears the TDB.TXT file afterwards. There is no signalling or anything fancy so there is no indication when the download process is finished. Also i didn't find an easy way to post a message to all logged in users via script. ting.sh should be executable and placed under /usr/local/lib 99-ting.rules is placed in /etc/udev/rules.d. The files are GPLv2 or later and created by me. Best regards Tim
ting.sh
(application/x-shellscript, 531 B)
#!/bin/bash
wdir=`mktemp -d`
mount $1 $wdir
cd $wdir/\$ting
while read line
do
i="${line#"${line%%[![:space:]]*}"}"
i="${i%"${i##*[![:space:]]}"}"
if [ "x$i" != "x" ]; then
echo "bookid:" $i
wget "http://system.ting.eu/book-files/get-description/id/$i/area/en" -O "${i}_en.txt"
wget "http://system.ting.eu/book-files/get/id/$i/area/en/type/thumb" -O "${i}_en.png";
wget "http://system.ting.eu/book-files/get/id/$i/area/en/type/archive" -O "${i}_en.ouf";
fi
done <"TBD.TXT"
echo >TBD.TXT
cd /
umount $wdir
rmdir $wdir
99-ting.rules
(text/plain, 115 B)
SUBSYSTEM=="block",KERNEL=="sd[a-z]",ACTION=="add",ATTRS{vendor}=="TingDisk",RUN:="/usr/local/lib/ting.sh /dev/%k"