Skip to content

Commit 839ff31

Browse files
committed
Wifi (macOS): work around #581
1 parent ebab281 commit 839ff31

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

CHANGELOG.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
# 2.1.1
22

3-
Changes:
4-
* SSID detection no longer works in macOS Sonoma. It will be marked as `<unknown ssid>` before I find a solution (Wifi, macOS)
5-
63
Features:
74
* Support opkg (Packages, Linux)
85
* Support GNOME Console terminal version and font detection (Terminal, Linux)

src/detection/wifi/wifi_apple.m

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include "wifi.h"
2+
#include "common/processing.h"
23

34
#import <CoreWLAN/CoreWLAN.h>
45

@@ -33,6 +34,17 @@
3334

3435
if (inf.ssid)
3536
ffStrbufAppendS(&item->conn.ssid, inf.ssid.UTF8String);
37+
else if (!ffProcessAppendStdOut(&item->conn.ssid, (char* []) {
38+
"/usr/sbin/networksetup",
39+
"-getairportnetwork",
40+
item->inf.description.chars,
41+
NULL
42+
}) && item->conn.ssid.length > 0)
43+
{
44+
uint32_t index = ffStrbufFirstIndexC(&item->conn.ssid, ':');
45+
if (index < item->conn.ssid.length)
46+
ffStrbufSubstrAfter(&item->conn.ssid, index + 1);
47+
}
3648
else
3749
ffStrbufSetStatic(&item->conn.ssid, "<unknown ssid>"); // https://developer.apple.com/forums/thread/732431
3850

0 commit comments

Comments
 (0)