This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Script reboot failing
#11
Code:
-- Script USB Reset Final pour LM5 OpenRB -- Version simplifiée et optimisée local function write_file_safe(file, value)     local f = io.open(file, "w")     if f then         local success, err = pcall(function()             f:write(value)             f:close()         end)         if success then             log("✓ Reset: " .. file)             return true         end     end     return false end -- Configuration LM5 validée local USB_BUSES = {     "/sys/devices/platform/soc/2100000.aips-bus/2184000.usb/ci_hdrc.0/usb1",     "/sys/devices/platform/soc/2100000.aips-bus/2184200.usb/ci_hdrc.1/usb2" } -- Reset USB rapide et efficace local function restart_usb_lm5()     log("=== Redémarrage USB LM5 ===")         for i, bus_path in ipairs(USB_BUSES) do         log("Reset bus USB" .. i .. "...")                 -- Désauthoriser le bus         write_file_safe(bus_path .. "/authorized", "0")         os.execute("sleep 1")                 -- Réauthoriser le bus          write_file_safe(bus_path .. "/authorized", "1")         os.execute("sleep 1")     end         log("✓ Reset USB terminé")         -- Attendre la détection des périphériques     os.execute("sleep 2")         -- Vérification     log("Vérification des périphériques USB...")     local handle = io.popen("dmesg | grep -E 'ttyUSB|ftdi_sio|SerialNumber' | tail -5 2>/dev/null")     if handle then         for line in handle:lines() do             log("  > " .. line)         end         handle:close()     end         log("=== Fin du redémarrage ===") end -- Fonction principale simplifiée local function main(arg)     if #arg == 0 or arg[1] == "restart" then         restart_usb_lm5()     else         log("Usage: main({\"restart\"}) ou main({})")     end end -- Auto-exécution main({})
It's OK With the help of Claude.ai  Wink
Jean-Marc
Reply


Messages In This Thread
Script reboot failing - by fbrun@domizy - 10.06.2024, 09:59
RE: Script reboot failing - by Daniel - 10.06.2024, 10:05
RE: Script reboot failing - by fbrun@domizy - 10.06.2024, 10:10
RE: Script reboot failing - by JMM - 24.06.2025, 14:21
RE: Script reboot failing - by Daniel - 24.06.2025, 14:42
RE: Script reboot failing - by JMM - 24.06.2025, 15:18
RE: Script reboot failing - by Daniel - 24.06.2025, 15:33
RE: Script reboot failing - by JMM - 24.06.2025, 15:48
RE: Script reboot failing - by Daniel - 24.06.2025, 15:53
RE: Script reboot failing - by JMM - 24.06.2025, 16:03
RE: Script reboot failing - by JMM - 24.06.2025, 17:28
RE: Script reboot failing - by admin - 25.06.2025, 07:17
RE: Script reboot failing - by JMM - 26.06.2025, 08:35
RE: Script reboot failing - by JMM - 04.07.2025, 10:09
RE: Script reboot failing - by Daniel - 04.07.2025, 12:42
RE: Script reboot failing - by admin - 07.07.2025, 11:20

Forum Jump: