do not autochange device when not unplugged in between
global was_uplugged is used for this. changes by touch are not affected
This commit is contained in:
@ -1708,7 +1708,7 @@ proc autodevice_cnt {value} {
|
|||||||
}
|
}
|
||||||
|
|
||||||
proc autodeviceCron {} {
|
proc autodeviceCron {} {
|
||||||
global change_device_to_none unplugged_device
|
global change_device_to_none unplugged_device was_unplugged
|
||||||
|
|
||||||
logconfig flush
|
logconfig flush
|
||||||
rack_check_connection
|
rack_check_connection
|
||||||
@ -1769,6 +1769,7 @@ clientput "CONFIG $device/$stick/$addons"
|
|||||||
set new [silent 0 result device newdevice]
|
set new [silent 0 result device newdevice]
|
||||||
set change_device_to_none 0
|
set change_device_to_none 0
|
||||||
if {$new eq "none"} {
|
if {$new eq "none"} {
|
||||||
|
set was_unplugged 1
|
||||||
if {$act eq "plugged"} {
|
if {$act eq "plugged"} {
|
||||||
set unplugged_device [result device name]
|
set unplugged_device [result device name]
|
||||||
if {$unplugged_device ne "none"} {
|
if {$unplugged_device ne "none"} {
|
||||||
@ -1784,9 +1785,11 @@ clientput "CONFIG $device/$stick/$addons"
|
|||||||
} elseif {$act eq "plugged" && $new eq [result device name]} {
|
} elseif {$act eq "plugged" && $new eq [result device name]} {
|
||||||
clientput "$new plugged, no change"
|
clientput "$new plugged, no change"
|
||||||
device makeitem confirmed $new
|
device makeitem confirmed $new
|
||||||
|
set was_unplugged 0
|
||||||
} else {
|
} else {
|
||||||
# new has changed and is not none
|
# new has changed and is not none
|
||||||
if {[result device name] ne "none" && $act eq "plugged"} {
|
set was_unplugged [silent 0 set was_unplugged]
|
||||||
|
if {[result device name] ne "none" && $act eq "plugged" && $was_unplugged == 0} {
|
||||||
clientlog "unplugged time too short [result device name] -> $new"
|
clientlog "unplugged time too short [result device name] -> $new"
|
||||||
# this was a quick hack
|
# this was a quick hack
|
||||||
# device makeitem confirmed none
|
# device makeitem confirmed none
|
||||||
@ -1798,6 +1801,7 @@ clientput "CONFIG $device/$stick/$addons"
|
|||||||
clientput "LOAD $new $act"
|
clientput "LOAD $new $act"
|
||||||
catch {samenv -q $new} msg
|
catch {samenv -q $new} msg
|
||||||
clientput $msg
|
clientput $msg
|
||||||
|
set was_unplugged 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
device action ""
|
device action ""
|
||||||
|
Reference in New Issue
Block a user