Version 84 of Steve Redler IV

Updated 2008-04-26 16:41:00 by stever

Steve Redler IV - aka SRIV email: steve-tclwiki at sr-tech.com

04-26-2008 I had this Saitek Pro Gamer Command Unit collecting dust because it wouldn't work in Linux, so I created a simple driver for it which uses TkXext to send keystrokes and pad movement to X.

http://www.trustedreviews.com/images/article/inline/2237-09.jpg

        proc readMouse {raw} {
                binary scan [string range $raw 12 13] s pos

                if {[string index $raw 10] == "\x01"} {
                        #up/down
                        set ::pointery [expr {int($::screenh * ($pos / 1024.00))}]
                } else {
                        #left/right
                        set ::pointerx [expr {int($::screenw * ($pos / 1024.00))}]
                }

                TkXext.move.pointer $::pointerx  $::pointery
                #puts "mouse $::pointerx $::pointery"
        }

        proc readKey {raw} {
                binary scan [string index $raw 10] c key
                incr key -32
                if {[string index $raw 12] == "\x01"} {
                        set pressed 1
                        TkXext.send.string [string index $::keymap $key]
                } else {
                        set pressed 0

                }
                #puts "key $key $pressed"
        }

        proc processEvent {fh} {
                set raw [read $fh 16]
                #puts "h=$hex"
                if {[string index $raw 8] == "\x01"} {readKey $raw}
                if {[string index $raw 8] == "\x03"} {readMouse $raw}
        }

        proc main {} {
                package require Tk
                load [file join $::starkit::topdir TkXext.so]
                wm geometry . 0x0+0+0
                wm overrideredirect . 1
                set ::keymap "qwertyuiopasdfghjklzxcvbnm,./"
                set ::screenh [winfo screenheight .]
                set ::screenw [winfo screenwidth .]
                set ::pointerx 512
                set ::pointery 512
                set device "/dev/input/event6"
                if {$::argc} {
                        set device $::argv
                }
                set evfh [open $device RDONLY]
                fconfigure $evfh -translation binary
                fileevent $evfh readable  "processEvent $evfh"
        }

        main

09-11-2007 Built a new quad-core computer, 8gig RAM with dual 30" LCDs driven by two Nvidia 8800s, here a pic: http://server.linuxsys.net/images/dual30sm.jpg

1-20-2005 I stopped at a big cigar store in Delaware today and got a new Humidor.

http://www.sriv.net/images/acid-humi-classic-logo.jpg

12-20-2004 Got a new Apple Bluetooth keyboard for my Linux workstation. In order to make it more plug and play, I wrote a small daemon to monitor for the keyboards presence and reconnect it automatically for when I turn off the keyboard but keep the computer running. Added multi-device capability so it auto-detects my MX900 mouse too.

http://www.sriv.net/images/bluetoothkey.jpg http://www.sriv.net/images/sr3lcd.jpg http://www.sriv.net/images/mx900.jpg

In rc.local, load all the proper Linux bluetooth drivers. ie:

  modprobe  hci_usb
  /usr/sbin/hciconfig hci0 up
  /usr/sbin/hcid
  modprobe hidp
  /usr/bin/hcitool scan
  #connect my Apple keyboard
  /usr/bin/hidd --connect 00:0A:95:3B:95:19
  #connect my Logitech mouse
  /usr/bin/hidd --connect 00:07:61:15:61:B0
  /root/bin/tclkit /root/bin/bluekbd > /dev/null &

The last line runs the bluekbd daemon, which is the following tcl script:

 #!/bin/sh
 # the next line restarts using wish \
 exec `which tclkit` "$0" "$@"

 while 1 {
        set command "/usr/bin/hidd --show"
        set status [eval exec $command]
        set ::delay 0

        foreach device {00:0A:95:3B:95:19 00:07:61:15:61:B0} {

            if {[string first $device $status] == -1} {
                set command "/usr/bin/hidd --connect $device"
                catch { eval exec $command } err
                puts "$device $err"
                after 1000 [list set ::delay 1]
             } else {
                after 10000 [list set ::delay 1]
             }
         }

    vwait ::delay        
 }
 # end of file

Change the device address 00:0A:95:3B:95:19 to that of your keyboard, as determined by hcitool scan.


At the 2004 Tcl Cnference in New Orleans Speaking to the internet audience listening to the live streaming audio feed.

http://www.sriv.net/images/conf20042003010104494301.jpg

Tips for pipe smokers: Place a pinch or two of sugar in the bottom of the bowl before you pack in the tobacco. Keep your tobacco barely hydrated. It should feel dry, but still be springy. Pack it tight to get a slow cool burn. Typically pack the bowl in 3 stages, pressing the tobaco in the bowl frimly. Gently draw on the pipe between packs to make sure air still flows adequately. Beginners, try Captain Black pipe tobaco in the white pouch.


Tips for cigar smokers: To maximize the flavor of a cigar, dont knock off the ash until its 2 inches long or longer, then relight the cigar just to get a continuous even burn.


Heres my first wiki contibution, a quick hack-up demo to rotate text and or graphics drawn on a canvas. Rotate text and images using img extension It unfortunately relies on a feature of the img extension, but, since its not difficult to place img into a tclkit, I find this preferable to using BLT to accomplish the same.

07-08-2003 My mission for today was to create a tcl DNS server. I compiled the tcludp extension on Linux, which was a snap. Next, I sat down with some books, packet captures, and an xterm running dig. Alas 12 hours later, I have a minimal Tcl DNS server.

11-27-2003 Finally got tclkit built on Windows in MinGW! With the help of Wojciech Kocjan's genkit which needed a little updating, I blended Wojciech's script with JCW's current genkit to develop a smooth working version that currently only works on Windows.

Details are here: Building tclkit in MinGW on WIndows

2004-02-08 Contributed weeCalc .


2004-05-19 Discuss SPF .


2004-05-22 TEA Streaming encryption extension


2004-06-09 Greylisting


2004-06-12 Network Activity Indicator


2004-06-16 Linux Console Text Editor In Pure TCL


2004-06-17 Diffie-Hellman Key Agreement Protocol


2004-08-28 Printing a text file to a lpr printer


2005-08-28 Enhancing Satellite Weather Images


2006-02-06 Generating The Wake On Lan Magic Packet


2006-05-01 Uploading Type1 fonts to a network printer


2008-01-19 Barcode generation to create code 128 B barcodes Springboard Code


escargo 11 Apr 2005 - I saw in your Whim screenshot an "SR-Files 1.0.5a". It looks a lot like X-Files (I earlier misremembered the name). Is it related?

SRIV It's X-Files actually, with a bunch of personal customizations.

escargo 13 Apr 2005 - Out of curiousity, were there any changes needed to make the old X-Files work on newer versions of Tk? SRIV It's been a while, I'd have to run a diff to know for sure. Heres a copy http://server.linuxsys.net/files/srfiles.kit .