From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tim Sander Date: Fri, 26 Jul 2013 19:48:09 +0000 Subject: Ting Stick Udev Support Message-Id: <6549306.UZb6P8InKs@virgo> MIME-Version: 1 Content-Type: multipart/mixed; boundary="nextPart4022398.knyg284Aln" List-Id: To: linux-hotplug@vger.kernel.org This is a multi-part message in MIME format. --nextPart4022398.knyg284Aln Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" 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 --nextPart4022398.knyg284Aln Content-Disposition: attachment; filename="ting.sh" Content-Transfer-Encoding: 7Bit Content-Type: application/x-shellscript; name="ting.sh" #!/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 --nextPart4022398.knyg284Aln Content-Disposition: attachment; filename="99-ting.rules" Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="UTF-8"; name="99-ting.rules" SUBSYSTEM=="block",KERNEL=="sd[a-z]",ACTION=="add",ATTRS{vendor}=="TingDisk",RUN:="/usr/local/lib/ting.sh /dev/%k" --nextPart4022398.knyg284Aln--