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 {} {
|
||||
global change_device_to_none unplugged_device
|
||||
global change_device_to_none unplugged_device was_unplugged
|
||||
|
||||
logconfig flush
|
||||
rack_check_connection
|
||||
@ -1769,6 +1769,7 @@ 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"} {
|
||||
@ -1784,9 +1785,11 @@ 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
|
||||
} else {
|
||||
# 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"
|
||||
# this was a quick hack
|
||||
# device makeitem confirmed none
|
||||
@ -1798,6 +1801,7 @@ clientput "CONFIG $device/$stick/$addons"
|
||||
clientput "LOAD $new $act"
|
||||
catch {samenv -q $new} msg
|
||||
clientput $msg
|
||||
set was_unplugged 0
|
||||
}
|
||||
}
|
||||
device action ""
|
||||
|
Reference in New Issue
Block a user