improve autodevice deature
for autodevice to work, it is not necessary to be unplugged for 60 seconds, only for a short time. fixed this behaviour
This commit is contained in:
@ -548,6 +548,14 @@ proc ccu4::update {} {
|
||||
}
|
||||
}
|
||||
}
|
||||
cda - cdb {
|
||||
set cda [hval [sct]/cda]
|
||||
set cdb [hval [sct]/cdb]
|
||||
set $name $value
|
||||
if {$cda == 999999 && $cdb == 999999} {
|
||||
device makeitem was_unplugged 1
|
||||
}
|
||||
}
|
||||
}
|
||||
set visible [silent true hgetpropval [sct]/$name visible]
|
||||
if {[silent notFound hlist [sct]/$name] eq "notFound"} {
|
||||
@ -639,7 +647,10 @@ clientlog RENEW
|
||||
if {[llength $guess] == 1} {
|
||||
set newdevice [lindex [split $guess .] 0]
|
||||
}
|
||||
}
|
||||
}
|
||||
if {$newdevice eq "none"} {
|
||||
device makeitem was_unplugged 1
|
||||
}
|
||||
device makeitem newdevice $newdevice
|
||||
if {$deviceaction == 3} {
|
||||
clientlog "PLUGGED $newdevice"
|
||||
|
@ -904,7 +904,7 @@ proc samenv args {
|
||||
global inside_samenv unconfigured_list vars logbase
|
||||
global objects_created objects_replaced objects_already device_name
|
||||
global selected_stick selected_addons
|
||||
global change_device_to_none was_unplugged
|
||||
global change_device_to_none
|
||||
|
||||
set inside_samenv 0
|
||||
set verbose 1
|
||||
@ -965,7 +965,6 @@ proc samenv args {
|
||||
}
|
||||
|
||||
set change_device_to_none 0
|
||||
set was_unplugged 0
|
||||
|
||||
set nl [split $name /]
|
||||
if {[llength $nl] == 1} {
|
||||
@ -1709,7 +1708,7 @@ proc autodevice_cnt {value} {
|
||||
}
|
||||
|
||||
proc autodeviceCron {} {
|
||||
global change_device_to_none unplugged_device was_unplugged
|
||||
global change_device_to_none unplugged_device
|
||||
|
||||
logconfig flush
|
||||
rack_check_connection
|
||||
@ -1770,7 +1769,6 @@ clientput "CONFIG $device/$stick/$addons"
|
||||
set new [silent 0 result device newdevice]
|
||||
set change_device_to_none 0
|
||||
if {$new eq "none"} {
|
||||
set was_unplugged 1
|
||||
if {$act eq "plugged"} {
|
||||
set unplugged_device [result device name]
|
||||
if {$unplugged_device ne "none"} {
|
||||
@ -1786,11 +1784,10 @@ clientput "CONFIG $device/$stick/$addons"
|
||||
} elseif {$act eq "plugged" && $new eq [result device name]} {
|
||||
clientput "$new plugged, no change"
|
||||
device makeitem confirmed $new
|
||||
set was_unplugged 0
|
||||
device makeitem was_unplugged 0
|
||||
} else {
|
||||
# new has changed and is not none
|
||||
set was_unplugged [silent 0 set was_unplugged]
|
||||
if {[result device name] ne "none" && $act eq "plugged" && $was_unplugged == 0} {
|
||||
if {[result device name] ne "none" && $act eq "plugged" && [silent 0 result device was_unplugged] == 0} {
|
||||
clientlog "unplugged time too short [result device name] -> $new"
|
||||
# this was a quick hack
|
||||
# device makeitem confirmed none
|
||||
@ -1802,7 +1799,7 @@ clientput "CONFIG $device/$stick/$addons"
|
||||
clientput "LOAD $new $act"
|
||||
catch {samenv -q $new} msg
|
||||
clientput $msg
|
||||
set was_unplugged 0
|
||||
device makeitem was_unplugged 0
|
||||
}
|
||||
}
|
||||
device action ""
|
||||
|
Reference in New Issue
Block a user