mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-12 09:58:03 +02:00
Wifi (macOS): print <unknown ssid> when we can't get SSID
SSID is not available after Sonoma. According to the doc: SSID information is not available unless Location Services is enabled and the user has authorized the calling app to use location services.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include "wifi.h"
|
||||
|
||||
#import <CoreWLAN/CoreWLAN.h>
|
||||
#import <CoreLocation/CLLocationManager.h>
|
||||
|
||||
const char* ffDetectWifi(FFlist* result)
|
||||
{
|
||||
@@ -31,7 +32,12 @@ const char* ffDetectWifi(FFlist* result)
|
||||
if(!inf.serviceActive)
|
||||
continue;
|
||||
|
||||
ffStrbufAppendS(&item->conn.ssid, inf.ssid.UTF8String);
|
||||
[CLLocationManager.new requestAlwaysAuthorization];
|
||||
if (inf.ssid)
|
||||
ffStrbufAppendS(&item->conn.ssid, inf.ssid.UTF8String);
|
||||
else
|
||||
ffStrbufSetStatic(&item->conn.ssid, "<unknown ssid>"); // https://developer.apple.com/forums/thread/732431
|
||||
|
||||
ffStrbufAppendS(&item->conn.macAddress, inf.hardwareAddress.UTF8String);
|
||||
switch(inf.activePHYMode)
|
||||
{
|
||||
@@ -116,6 +122,9 @@ const char* ffDetectWifi(FFlist* result)
|
||||
case 15 /*kCWSecurityOWETransition*/:
|
||||
ffStrbufAppendS(&item->conn.security, "OWE Transition");
|
||||
break;
|
||||
case kCWSecurityUnknown:
|
||||
// Ignore
|
||||
break;
|
||||
default:
|
||||
ffStrbufAppendF(&item->conn.security, "Unknown (%ld)", inf.security);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user