#!/usr/bin/wish # # Control panel for the lpt_driver LCD display driver software # Copyright Carl D. Walker May 10, '98 GPL # # Purpose: Locates the current, running lpt_driver process and sends # signals to it for the control of operating modes. It beats having # to send signals to it from the keyboard! # # If you try to start this program without the lpt_driver daemon running, it will # exit and complain about 'child process exiting abnormally', like so... # #[root@BigDog v01]# Error in startup script: child process exited abnormally # while executing #"exec ps aux | grep "lpt_driver"" # (procedure "find_lpt" line 3) # invoked from within #"find_lpt" # (file "./lpt_panel" line 62) # # if you are debugging, and kill the lpt_driver process after starting the lpt_panel # program, just restart the lpt_driver daemon, and press the PID button again. This will # re-discover the PID of the lpt_driver daemon. # proc find_lpt {} { global target_pid set returned_string [exec ps aux | grep "lpt_driver"]; #find the pid for the lpt_driver #the string returned will look like this... #root 401 0.9 0.3 724 396 ? S 14:36 12:51 /root/lpt_driver/lpt_ #the pid is the first number... scan $returned_string "root %d" target_pid .find configure -text "PID $target_pid" } proc change_temp {} { global target_pid catch {exec kill -HUP $target_pid} } proc change_mode {} { global target_pid catch {exec kill -USR1 $target_pid} } proc log_temp {} { global target_pid catch {exec kill -USR2 $target_pid} } # Program starts here..... # globals... set target_pid "" #buttons... button .find -text "Process" -fg black -bg yellow -command find_lpt button .hup -text "Deg C/F" -fg black -bg green -command change_temp button .usr1 -text "Mode" -fg black -bg green -command change_mode button .usr2 -text "Log" -fg black -bg green -command log_temp button .quit -text "Exit" -fg white -bg red -command exit pack .find .hup .usr1 .usr2 .quit -side left -expand 1 -fill both wm title . "lpt_panel Version 0.01" #find the pid find_lpt