From b29440c93a8ced189bb69b1fe08fd268f6d3ef42 Mon Sep 17 00:00:00 2001 From: ian Date: Sun, 13 Jul 2008 21:51:42 +0000 Subject: [PATCH] better bind-input command construction --- hostside/gui | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/hostside/gui b/hostside/gui index e0a294a..9e29278 100755 --- a/hostside/gui +++ b/hostside/gui @@ -525,8 +525,22 @@ proc ib-create/wheelmouse {devid wunique desc} { set in(speedw) $w } +proc ib-evcmd/wheelmouse {devid target} { + return [ib-evcmd-construct $devid $target --grab] +} + #---------- input device evdev binding ---------- +proc ib-evcmd-construct {devid target xargs} { + upvar #0 input/$devid in + manyset $target ev sysfs + return [concat \ + [list ./evdev-manip] $xargs \ + [list --stdin-monitor \ + --expect-sysfs /sys$sysfs/$ev/dev \ + /dev/input/$ev]] +} + proc bind-input {bus vendor product version concrete args} { global input_bindings set devid $bus:$vendor:$product:$version @@ -604,15 +618,8 @@ proc scan-input-bindings {} { if {$newlast > $now + $inputretrymax} continue if {$newlast < $now} { set newlast $now } set in(laststart) $newlast - if {[catch { info args ib-evcmd/$in(concrete) }]} { - manyset [lindex $target($devid) 0] ev sysfs - set cmdl [list 2>@ stderr ./evdev-manip --grab --stdin-monitor \ - --expect-sysfs /sys$sysfs/$ev/dev \ - /dev/input/$ev] - } else { - set cmdl [eval [list ib-evcmd/$in(concrete) $devid] \ - $target($devid)] - } + set cmdl [eval [list ib-evcmd/$in(concrete) $devid] $target($devid)] + lappend cmdl 2>@ stderr catch-for-input-binding $devid { debug "ib $devid running $cmdl" set in(chan) [open |$cmdl r+] -- 2.30.2