feat: wi-fi - expand support and fix issues, add GUI components
This commit is contained in:
@@ -182,6 +182,13 @@ namespace montauk::abi {
|
||||
// Paginated directory read (path, names, max, startIndex)
|
||||
static constexpr uint64_t SYS_READDIR_AT = 136;
|
||||
|
||||
// Set adapter BD_ADDR (6-byte buffer, addr[0] = LSB)
|
||||
static constexpr uint64_t SYS_BTSETADDR = 137;
|
||||
|
||||
// List bonded (paired) devices / forget a bond
|
||||
static constexpr uint64_t SYS_BTBONDS = 138;
|
||||
static constexpr uint64_t SYS_BTFORGET = 139;
|
||||
|
||||
/* Sdr.hpp -- software-defined radio receive API */
|
||||
static constexpr uint64_t SYS_SDR_COUNT = 140; // number of receivers
|
||||
static constexpr uint64_t SYS_SDR_INFO = 141; // (index, SdrDeviceInfo*)
|
||||
@@ -192,13 +199,36 @@ namespace montauk::abi {
|
||||
static constexpr uint64_t SYS_SDR_READ = 146; // (handle, buf, len) -> bytes
|
||||
static constexpr uint64_t SYS_SDR_SETPARAM = 147; // (handle, param, value)
|
||||
static constexpr uint64_t SYS_SDR_GETPARAM = 148; // (handle, param) -> value
|
||||
|
||||
// CPU power/thermal status
|
||||
static constexpr uint64_t SYS_POWERINFO = 149; // (PowerInfo*) -> 0, -1 unsupported
|
||||
|
||||
// Framebuffer page flip (double-buffered scanout)
|
||||
static constexpr uint64_t SYS_FBFLIP = 150;
|
||||
|
||||
// Absolute path of the running executable (for argv[0]).
|
||||
static constexpr uint64_t SYS_GETEXECPATH = 151; // (index, flags) -> new front index; index=-1 queries support (1/0); flags bit0 = wait vsync
|
||||
|
||||
// Path metadata (size, timestamps, mode). (const char* path, FileStat* out) -> 0, -1 on error/unsupported.
|
||||
static constexpr uint64_t SYS_STAT = 152;
|
||||
static constexpr uint64_t SYS_SETUNIXTIME = 153;
|
||||
|
||||
// Display/modesetting control
|
||||
static constexpr uint64_t SYS_DISPLAYINFO = 154;
|
||||
static constexpr uint64_t SYS_DISPLAYMODES = 155;
|
||||
static constexpr uint64_t SYS_DISPLAYSETMODE = 156;
|
||||
static constexpr uint64_t SYS_DISPLAYBRIGHTNESS = 157;
|
||||
|
||||
// Wi-Fi adapter control
|
||||
static constexpr uint64_t SYS_WIFI_SCAN = 158; // (WifiNetwork*, maxCount, timeoutMs) -> count
|
||||
static constexpr uint64_t SYS_WIFI_INFO = 159; // (WifiInfo*) -> 0, -1 if absent
|
||||
static constexpr uint64_t SYS_WIFI_CONNECT = 160; // (ssid, password) -> 0, <0 on error
|
||||
static constexpr uint64_t SYS_WIFI_DISCONNECT = 161; // () -> 0
|
||||
static constexpr uint64_t SYS_WIFI_SCAN_START = 162; // (timeoutMs) -> 0 started, 1 busy, -1 no adapter
|
||||
static constexpr uint64_t SYS_WIFI_RESULTS = 163; // (WifiNetwork*, maxCount) -> count, no radio work
|
||||
static constexpr uint64_t SYS_WIFI_CONNECT_ASYNC = 164; // (ssid, password) -> 0 accepted, <0 on error
|
||||
static constexpr uint64_t SYS_NETIFS = 165; // (NetIfInfo*, maxCount) -> count
|
||||
|
||||
// Tunable parameters (for SYS_SDR_SETPARAM / SYS_SDR_GETPARAM).
|
||||
static constexpr int SDR_PARAM_FREQ = 0; // center frequency, Hz
|
||||
static constexpr int SDR_PARAM_SAMPLE_RATE = 1; // sample rate, Hz
|
||||
@@ -238,7 +268,7 @@ namespace montauk::abi {
|
||||
static constexpr int AUDIO_CTL_PAUSE = 3;
|
||||
static constexpr int AUDIO_CTL_GET_OUTPUT = 4; // 0=HDA, 1=Bluetooth
|
||||
static constexpr int AUDIO_CTL_SET_OUTPUT = 5; // Switch audio output
|
||||
static constexpr int AUDIO_CTL_BT_STATUS = 6; // Get Bluetooth status
|
||||
static constexpr int AUDIO_CTL_BT_STATUS = 6; // 0=unavailable, 1=setup, 2=ready
|
||||
static constexpr int AUDIO_CTL_SET_MASTER_VOLUME = 7; // 0-100
|
||||
static constexpr int AUDIO_CTL_GET_MASTER_VOLUME = 8;
|
||||
static constexpr int AUDIO_CTL_SET_MUTE = 9; // 0/1, per-stream
|
||||
@@ -279,6 +309,17 @@ namespace montauk::abi {
|
||||
uint8_t Second;
|
||||
};
|
||||
|
||||
// Path metadata returned by SYS_STAT. Timestamps are UTC unix seconds;
|
||||
// a filesystem that does not record a given time reports it as 0.
|
||||
struct FileStat {
|
||||
uint64_t size; // file size in bytes
|
||||
int64_t mtime; // last data modification time
|
||||
int64_t ctime; // last inode (metadata) change time
|
||||
int64_t atime; // last access time
|
||||
uint32_t mode; // ext2/POSIX mode bits (type + permissions)
|
||||
uint32_t isDir; // 1 if the entry is a directory, else 0
|
||||
};
|
||||
|
||||
struct FbInfo {
|
||||
uint64_t width;
|
||||
uint64_t height;
|
||||
@@ -321,7 +362,7 @@ namespace montauk::abi {
|
||||
uint32_t capabilities;
|
||||
uint32_t modeCount;
|
||||
int32_t currentMode;
|
||||
int32_t brightness;
|
||||
int32_t brightness; // 0..100, or -1 when unavailable
|
||||
uint16_t deviceId;
|
||||
uint8_t generation;
|
||||
uint8_t connectorType;
|
||||
@@ -509,6 +550,12 @@ namespace montauk::abi {
|
||||
char name[64];
|
||||
};
|
||||
|
||||
// Bluetooth bonded (paired) device (returned by SYS_BTBONDS)
|
||||
struct BtBondInfo {
|
||||
uint8_t bdAddr[6];
|
||||
uint8_t _pad[2];
|
||||
};
|
||||
|
||||
// Software-defined radio receiver description (returned by SYS_SDR_INFO).
|
||||
struct SdrDeviceInfo {
|
||||
char name[64]; // e.g. "Realtek RTL2832U"
|
||||
@@ -527,12 +574,113 @@ namespace montauk::abi {
|
||||
uint32_t _pad2;
|
||||
};
|
||||
|
||||
// Wi-Fi security suites reported in WifiNetwork.security.
|
||||
static constexpr uint8_t WIFI_SEC_OPEN = 0;
|
||||
static constexpr uint8_t WIFI_SEC_WEP = 1;
|
||||
static constexpr uint8_t WIFI_SEC_WPA = 2;
|
||||
static constexpr uint8_t WIFI_SEC_WPA2 = 3;
|
||||
static constexpr uint8_t WIFI_SEC_WPA3 = 4;
|
||||
|
||||
// Adapter states reported in WifiInfo.state.
|
||||
static constexpr uint8_t WIFI_STATE_ABSENT = 0; // no device
|
||||
static constexpr uint8_t WIFI_STATE_DETECTED = 1; // waiting for firmware load
|
||||
static constexpr uint8_t WIFI_STATE_BOOTING = 2;
|
||||
static constexpr uint8_t WIFI_STATE_RUNNING = 3;
|
||||
static constexpr uint8_t WIFI_STATE_ERROR = 4;
|
||||
static constexpr uint8_t WIFI_STATE_RFKILL = 5; // radio disabled in hardware
|
||||
|
||||
// One scanned network (returned by SYS_WIFI_SCAN).
|
||||
struct WifiNetwork {
|
||||
char ssid[36]; // NUL-terminated; empty for hidden networks
|
||||
uint8_t bssid[6];
|
||||
uint8_t channel;
|
||||
int8_t rssi; // dBm
|
||||
uint8_t band; // 0 = 2.4 GHz, 1 = 5 GHz
|
||||
uint8_t security; // WIFI_SEC_*
|
||||
uint16_t beaconInterval; // TU
|
||||
};
|
||||
|
||||
// Association progress reported in WifiInfo.connState.
|
||||
static constexpr uint32_t WIFI_CONN_IDLE = 0;
|
||||
static constexpr uint32_t WIFI_CONN_CONTEXTS_UP = 1;
|
||||
static constexpr uint32_t WIFI_CONN_AUTHENTICATING = 2;
|
||||
static constexpr uint32_t WIFI_CONN_AUTHENTICATED = 3;
|
||||
static constexpr uint32_t WIFI_CONN_ASSOCIATING = 4;
|
||||
static constexpr uint32_t WIFI_CONN_ASSOCIATED = 5;
|
||||
static constexpr uint32_t WIFI_CONN_HANDSHAKING = 6;
|
||||
static constexpr uint32_t WIFI_CONN_CONNECTED = 7;
|
||||
static constexpr uint32_t WIFI_CONN_FAILED = 8;
|
||||
|
||||
// Negative results from SYS_WIFI_CONNECT.
|
||||
static constexpr int WIFI_ERR_NO_ADAPTER = -1; // no adapter, or not ready
|
||||
static constexpr int WIFI_ERR_NOT_FOUND = -2; // SSID absent from the scan
|
||||
static constexpr int WIFI_ERR_NEED_KEY = -3; // encrypted, no passphrase
|
||||
static constexpr int WIFI_ERR_UNSUPPORTED = -4; // WPA3-SAE, WEP, enterprise
|
||||
static constexpr int WIFI_ERR_AUTH = -5; // key exchange rejected
|
||||
static constexpr int WIFI_ERR_TIMEOUT = -6; // AP never answered
|
||||
static constexpr int WIFI_ERR_FAILED = -7; // anything else
|
||||
|
||||
// Adapter status (returned by SYS_WIFI_INFO).
|
||||
struct WifiInfo {
|
||||
uint8_t mac[6];
|
||||
uint8_t present; // 1 if a supported device was found
|
||||
uint8_t state; // WIFI_STATE_*
|
||||
uint8_t scanning;
|
||||
uint8_t bands; // bit0 = 2.4 GHz, bit1 = 5 GHz
|
||||
uint16_t channels; // usable channels after regulatory filtering
|
||||
char fwVersion[32];
|
||||
uint64_t rxPackets;
|
||||
uint32_t fwErrors;
|
||||
uint32_t connState; // WIFI_CONN_*
|
||||
uint64_t txPackets;
|
||||
char ssid[36]; // network joined, empty when disconnected
|
||||
uint8_t bssid[6];
|
||||
uint8_t connected; // 1 once the link can carry IP traffic
|
||||
uint8_t channel;
|
||||
int32_t lastError; // WIFI_ERR_* from the last async join, 0 = none
|
||||
uint32_t scanGeneration; // bumped every time a scan finishes
|
||||
uint8_t joining; // 1 while an async join is in flight
|
||||
uint8_t _pad[3];
|
||||
};
|
||||
|
||||
// Link-layer interface kinds reported in NetIfInfo.kind.
|
||||
static constexpr uint8_t NETIF_KIND_ETHERNET = 0;
|
||||
static constexpr uint8_t NETIF_KIND_WIRELESS = 1;
|
||||
|
||||
// One registered link-layer interface (returned by SYS_NETIFS). The IP
|
||||
// configuration is global to the stack, so it belongs to whichever
|
||||
// interface reports active = 1.
|
||||
struct NetIfInfo {
|
||||
char name[16]; // "eth0", "wlan0"
|
||||
uint8_t mac[6];
|
||||
uint8_t kind; // NETIF_KIND_*
|
||||
uint8_t linkUp;
|
||||
uint8_t active; // 1 if this is the interface carrying traffic
|
||||
uint8_t _pad[3];
|
||||
};
|
||||
|
||||
struct ThermalInfo {
|
||||
char name[32]; // short zone name (e.g. "THRM", "TZ00")
|
||||
int32_t temperature; // tenths of degrees Celsius, or -1 if unavailable
|
||||
uint32_t _pad;
|
||||
};
|
||||
|
||||
// CPU power/thermal snapshot (returned by SYS_POWERINFO)
|
||||
struct PowerInfo {
|
||||
uint8_t hwpActive; // hardware P-state scaling enabled
|
||||
uint8_t throttling; // thermal governor currently limiting frequency
|
||||
uint8_t tempC; // package temperature, degrees C (0 = unknown)
|
||||
uint8_t tjMaxC; // hardware throttle temperature
|
||||
uint8_t highestPerf; // HWP performance range (ratio units)
|
||||
uint8_t lowestPerf;
|
||||
uint8_t curMaxPerf; // thermal governor's current ceiling
|
||||
uint8_t epp; // energy/perf preference (0=perf, 255=power)
|
||||
uint32_t baseMHz; // nominal base frequency (0 = unknown)
|
||||
uint32_t maxMHz; // max turbo frequency
|
||||
uint32_t effMHz; // measured average active frequency
|
||||
uint32_t apIdleHint; // MWAIT hint used for AP deep idle
|
||||
};
|
||||
|
||||
struct ProcInfo {
|
||||
int32_t pid;
|
||||
int32_t parentPid;
|
||||
|
||||
Reference in New Issue
Block a user