hrev56188 adds 2 changesets to branch 'master'
old head: 850fc02fa28a914f0b2fa25dbb83f9b8497904cc
new head: 73d88d4ee6b1984ac73e0c63224cb5f59052e471
overview:
https://git.haiku-os.org/haiku/log/?qt=range&q=73d88d4ee6b1+%5E850fc02fa28a
----------------------------------------------------------------------------
1adb7124273a: preferences/network: Use ifconfig's MediaTypes object instead of
recompiling.
The next commit will make it depend on FreeBSD headers,
which we do not have available here.
73d88d4ee6b1: ifconfig: Add basic IEEE 802.11 media types to the list.
This requires using the FreeBSD if_media.h (for now, anyway)
and adding a subtype_mask to the data structures. But this
does work.
Now 802.11 media will be displayed in ifconfig and Network
preferences.
[ Augustin Cavalier <waddlesplash@xxxxxxxxx> ]
----------------------------------------------------------------------------
2 files changed, 34 insertions(+), 9 deletions(-)
src/bin/network/ifconfig/MediaTypes.cpp | 37 +++++++++++++++++++++++++----
src/preferences/network/Jamfile | 6 ++---
############################################################################
Commit: 1adb7124273a40e2eb68a3cf50fbcb5c41e9c78a
URL: https://git.haiku-os.org/haiku/commit/?id=1adb7124273a
Author: Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date: Tue Jun 14 02:44:31 2022 UTC
preferences/network: Use ifconfig's MediaTypes object instead of recompiling.
The next commit will make it depend on FreeBSD headers,
which we do not have available here.
----------------------------------------------------------------------------
diff --git a/src/preferences/network/Jamfile b/src/preferences/network/Jamfile
index 532057c787..7cc3715d8f 100644
--- a/src/preferences/network/Jamfile
+++ b/src/preferences/network/Jamfile
@@ -24,10 +24,8 @@ Preference Network :
RadioView.cpp
WirelessNetworkMenuItem.cpp
- # from ifconfig
- MediaTypes.cpp
-
- : be bnetapi shared [ TargetLibstdc++ ] localestub
+ : <src!bin!network!ifconfig>MediaTypes.o
+ be bnetapi shared [ TargetLibstdc++ ] localestub
: Network.rdef InterfaceIcons.rdef
;
############################################################################
Revision: hrev56188
Commit: 73d88d4ee6b1984ac73e0c63224cb5f59052e471
URL: https://git.haiku-os.org/haiku/commit/?id=73d88d4ee6b1
Author: Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date: Tue Jun 14 02:46:44 2022 UTC
ifconfig: Add basic IEEE 802.11 media types to the list.
This requires using the FreeBSD if_media.h (for now, anyway)
and adding a subtype_mask to the data structures. But this
does work.
Now 802.11 media will be displayed in ifconfig and Network
preferences.
----------------------------------------------------------------------------
diff --git a/src/bin/network/ifconfig/MediaTypes.cpp
b/src/bin/network/ifconfig/MediaTypes.cpp
index ecead54a79..11c45b04d1 100644
--- a/src/bin/network/ifconfig/MediaTypes.cpp
+++ b/src/bin/network/ifconfig/MediaTypes.cpp
@@ -11,14 +11,19 @@
#include "MediaTypes.h"
-#include <net/if_media.h>
+#include <stdint.h>
#include <string.h>
+extern "C" {
+# include <freebsd_network/compat/net/if_media.h>
+}
+
struct media_type {
int type;
const char* name;
const char* pretty;
+ int subtype_mask;
struct {
int subtype;
const char* name;
@@ -38,13 +43,14 @@ const media_type kMediaTypes[] = {
0, // for generic options
"all",
"All",
+ IFM_TMASK,
{
{ IFM_AUTO, "auto", "Auto-select" },
{ -1, NULL, NULL }
},
{
- { IFM_FULL_DUPLEX, true, "fullduplex", "Full Duplex" },
- { IFM_HALF_DUPLEX, true, "halfduplex", "Half Duplex" },
+ { IFM_FDX, true, "fullduplex", "Full Duplex" },
+ { IFM_HDX, true, "halfduplex", "Half Duplex" },
{ IFM_LOOP, true, "loop", "Loop" },
//{ IFM_ACTIVE, false, "active", "Active" },
{ -1, false, NULL, NULL }
@@ -54,6 +60,7 @@ const media_type kMediaTypes[] = {
IFM_ETHER,
"ether",
"Ethernet",
+ IFM_TMASK,
{
//{ IFM_AUTO, "auto", "Auto-select" },
//{ IFM_AUI, "AUI", "10 MBit, AUI" },
@@ -73,7 +80,26 @@ const media_type kMediaTypes[] = {
{ -1, false, NULL, NULL }
}
},
- { -1, NULL, NULL, {{ -1, NULL, NULL }}, {{ -1, false, NULL, NULL }} }
+ {
+ IFM_IEEE80211,
+ "80211",
+ "Wireless Ethernet",
+ IFM_MMASK,
+ {
+ { IFM_IEEE80211_11A, "802.11a", "802.11a" },
+ { IFM_IEEE80211_11B, "802.11b", "802.11b" },
+ { IFM_IEEE80211_11G, "802.11g", "802.11g" },
+ { IFM_IEEE80211_FH, "802.11 FH", "802.11 FH" },
+ { IFM_IEEE80211_11NA, "802.11n(a)", "802.11n(a)" },
+ { IFM_IEEE80211_11NG, "802.11n(g)", "802.11n(g)" },
+ { IFM_IEEE80211_VHT5G, "802.11ac", "802.11ac" },
+ { -1, NULL, NULL }
+ },
+ {
+ { -1, false, NULL, NULL }
+ }
+ },
+ { -1, NULL, NULL, -1, {{ -1, NULL, NULL }}, {{ -1, false, NULL, NULL }}
}
};
@@ -132,8 +158,9 @@ media_type_to_string(int media)
&& kMediaTypes[i].type != IFM_TYPE(media))
continue;
+ const int subtype = (media & kMediaTypes[i].subtype_mask);
for (size_t j = 0; kMediaTypes[i].subtypes[j].subtype >= 0;
j++) {
- if (kMediaTypes[i].subtypes[j].subtype ==
IFM_SUBTYPE(media)) {
+ if (kMediaTypes[i].subtypes[j].subtype == subtype) {
// found a match
return kMediaTypes[i].subtypes[j].pretty;
}