Steve Redler IV

Steve Redler IV - aka SRIV email: steve kötőjel wikitcl kukac sr kötőjel 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. I just modified it to handle plugging/unplugging of the unit from the USB port.Also added autodetect of /dev/input/event# so now the driver finds the Command Unit in any USB port.

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
        }
        
        proc readKey {raw} {
                binary scan [string index $raw 10] c key
                incr key -32
                if {[string index $raw 12] == "\x01"} {
                        #key pressed
                        TkXext.send.string [string index $::keymap $key]
                }
        }
        
        proc processEvent {fh} {
                if {[catch {set raw [read $fh 16]}]} {
                        fileevent $fh readable {}
                        catch {close $fh}
                        after 5000 detectUnit
                        return
                }
                if {[string index $raw 8] == "\x01"} {readKey $raw}
                if {[string index $raw 8] == "\x03"} {readMouse $raw}
        }
        
        
        proc detectUnit {} {
                set fh [open /proc/bus/input/devices r]
                set deviceinfo [read $fh]
                close $fh
                
                set found 0
                foreach line [split $deviceinfo \n] {
                        if {$found} {
                                if {[string first "Handlers" $line] == -1} {continue}
                                break
                        }
                        if {[string first "Saitek Pro Gamer Command Unit" $line] == -1} {continue}
                        set found 1
                }
                
                set device [file join /dev/input/[lindex [split [string trim $line] =]        1]]
                
                if {$found} {
                        set evfh [open $device RDONLY]
                        fconfigure $evfh -translation binary
                        fileevent $evfh readable  "processEvent $evfh"
                } else {
                        after 5000 detectUnit
                }
        }
        
        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
                after 100 detectUnit
        }
        
        main

Download a finished zipkit here: [L1 ]. To use it, plug in your Command Unit to a USB, then run the following command:

  tclkit saitekdriver.bin 

and thats it! The joypad should move your mouse about the display, and each key is mapped to a letter in the alphabet.


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

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


2008-06-1 Modbus PLC Communications Driver


2010-09-18 Creating an OpenOffice Spreadsheet in pure Tcl


2010-09-19 Validating an International Bank Account Number