revert #2: Добавлено отслеживение длины нажатий кнопки. Это нужно для отключения самбы и размонтирования флешки. (спустя два часа страданий)
This commit is contained in:
2026-04-15 05:41:21 +00:00
parent e622c95666
commit 17e1925034
2 changed files with 24 additions and 106 deletions

View File

@@ -27,7 +27,7 @@ object DebugMode {
// Состояния системы
enum class SystemState {
IDLE, SCANNING, CLEAN, INFECTED, ERROR, INIT, SAMBA
IDLE, SCANNING, CLEAN, INFECTED, ERROR, INIT
}
class USBVirusScanner {
@@ -159,11 +159,6 @@ class USBVirusScanner {
yellowLed.setValue(0)
blinkLed(redLed, 500)
}
SystemState.SAMBA -> {
blinkLed(greenLed, 1000)
blinkLed(yellowLed, 1000)
redLed.setValue(0)
}
}
}
}
@@ -321,7 +316,7 @@ class USBVirusScanner {
try {
// Проверяем установлен ли ClamAV
val checkProcess = ProcessBuilder("which", "clamdscan").start()
val checkProcess = ProcessBuilder("which", "clamscan").start()
val checkExitCode = checkProcess.waitFor()
if (checkExitCode != 0) {
@@ -543,20 +538,9 @@ fun main(args: Array<String>) {
scanner.initialize()
val buttonListener = ButtonListener()
buttonListener.shortPressThresholdMs = 100
buttonListener.longPressThresholdMs = 1000
buttonListener.addClickListener { event ->
scanner.startScan()
}
buttonListener.addLongPressListener { event ->
println(if (isDebug) "ДЛИННОЕ НАЖАТИЕ МЯУ" else "")
println("TODO(\"Добавить отключение samba и размонтирование флешки\")")
}
buttonListener.startListening()
println(if (isDebug) """
@@ -580,5 +564,4 @@ fun main(args: Array<String>) {
scanner.shutdown()
exitProcess(1)
}
}