- Full TinyBasic interpreter (InputInterpreter) with tick-based execution: PRINT, LET, IF/THEN, GOTO, GOSUB/RETURN, INPUT, FOR/NEXT, REM, END, RUN, LIST, NEW, SAVE, LOAD, POKE/PEEK, POKEX/PEEKX, RND, MOD - Expression evaluator with hex literals ($xx), operator precedence, variables A-Z, and functions (PEEK, PEEKX, RND) - CTRL+C / CTRL+PAUSE to break running programs - DiskManager: USB stick detection via netlink, udisksctl mount, Micronona stick initialization - ScrollLockLed: Scroll Lock LED indicates stick presence via sysfs - ConsoleHelper: ReadLine follows ASCII-31 wrap markers across lines - udev rule for LED brightness write permissions Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
28 lines
655 B
C#
28 lines
655 B
C#
internal class ScrollLockLed
|
|
{
|
|
private readonly string[] _paths;
|
|
private bool _state;
|
|
|
|
public ScrollLockLed()
|
|
{
|
|
_paths = Directory.GetDirectories("/sys/class/leds/", "*scrolllock*");
|
|
}
|
|
|
|
public void Set(bool on)
|
|
{
|
|
_state = on;
|
|
Write();
|
|
}
|
|
|
|
public void Refresh() => Write();
|
|
|
|
private void Write()
|
|
{
|
|
string value = _state ? "1" : "0";
|
|
foreach (var path in _paths)
|
|
{
|
|
try { File.WriteAllText(Path.Combine(path, "brightness"), value); }
|
|
catch (Exception ex) { Console.Error.WriteLine($"ScrollLockLed [{path}]: {ex.Message}"); }
|
|
}
|
|
}
|
|
}
|