zxystd/AppleIntelWifiAdapter

Inherit from IOEthernetController

Closed this issue · 7 comments

class AppleIntelWifiAdapterV2 : public IO80211Controller

Hi @zxystd,

I wonder why almost every project related to Intel support on macOS either

  1. inherits from IOService with IOPCIDevice
  2. tries to reverse engineer IO80211Family.kext headers

Honestly curious, and would love to learn the motivation behind it.

I've learned a bit about macOS KEXT development over the years, wouldn't consider myself an expert, but am curious why nobody inherits from IOEthernetController. You would normally subclass it when writing drivers for Ethernet or WIFI (802.11) devices.

There have been many attempts in the past which I've sadly all seen fail or abandoned after a while. I applaud anyone who attempts (2), but it might not be the most sustainable option in the long term (and it's $%!#ing hard).

Using IOEthernetController and ignoring IO80211Family has the downside of not being able to use the built-in network utils (not 100% sure about this statement). It would therefore require shipping our own IOUserClient + user space tool for configuration of the device.

I have the feeling that I'm missing something important, but I'd appreciate a discussion about this and hope that it bears fruit. :-)

(from what I understand) IO80211Family has a lot of utility in it including a WPA Supplicant which would likely be better to use rather than people trying to roll their own. What you describe is probably what a lot of USB wifi devices do though....

According to @zxystd (I'm in the same chat group with him), Apple's IO80211 varies hugely between different macOS major versions, the code needs to be adjusted for every major version and this may require tons of work to do, the compiled binary with an IO80211 header is not capable with any older or newer macOS versions.

So, in order to support different versions of macOS, there needs to be dedicated branches with adjusted code, release binaries need to be separated as well. It might be a pain to maintain.

I believe this is his major concern.

According to @zxystd (I'm in the same chat group with him), Apple's IO80211 varies hugely between different macOS major versions, the code needs to be adjusted for every major version and this may require tons of work to do, the compiled binary with an IO80211 header is not capable with any older or newer macOS versions.

Yes, I'm aware of that. That's what I was referring to with "[...] might not be the most sustainable option". So I guess we agree on that? :-)

(from what I understand) IO80211Family has a lot of utility in it including a WPA Supplicant which would likely be better to use rather than people trying to roll their own. What you describe is probably what a lot of USB wifi devices do though....

Ok, I'll look into that and come back as soon as I know more. Curious if there might be any open source alternative we can copy over from FreeBSD in conjuntion with implementing a IOEthernetInterface as a connection to the actual BSD layer.

@cihantas

Curious if there might be any open source alternative we can copy over from FreeBSD in conjuntion with implementing a IOEthernetInterface as a connection to the actual BSD layer.

@zxystd did an experiment based on OpenBSD, and now it's able to connect to the Internet. FreeBSD might be the best choice since it has the newest implementation (even newer than Linux), OpenBSD's 80211 used in the experimental project is a bit out of date and zxystd is currently working to update it based on the newest source code on GitHub to support 802.11ac

Project URL: https://github.com/zxystd/itlwm

Fantastic. Did a napkin sketch yesterday, before creating the issue, and came up with that idea. Didn't see the new project. Guess my assumption might be correct. I would've implemented it myself, if I couldn't convince anyone, but if @zxystd is already on it that's even better. :-)

Do I understand you correctly: @zxystd is going to stick with an (up-to-date) OpenBSD implementation and not switch to FreeBSD iwm?

Honestly, I have seen the FreeBSD iwm sourcecode after I finish migrate net80211 and iwm from OpenBSD... FreeBSD source code is more closer to MacOS, somtimes I also want to rewrite all from FreeBSD, but I give up, just because at this stage I don't know too much about wireless and pci device driver programming, also there is too much driver theory needs to be verified, so I take advantage of this opportunity to learn more about these, through gradually improving itliwm project, maybe I can start another project from FreeBSD's iwm and make it more perfect).

Thanks for joining the discussion @zxystd. :-)

[...] FreeBSD source code is more closer to MacOS

That's because XNU is pretty much a heavily modified fork of the FreeBSD Kernel, but I'm pretty sure a lot of code was sourced from FreeBSD after that, too.

Ok, I didn't know you were new to this area. It's a great learning project indeed and a lot of progress so far.

I might jump on the bandwagon then and build it with the approach laid out above. Been a FreeBSD and MacOS user for quite some time now. Bought a Thinkpad with an Intel card a week ago and just going to write a driver instead of buying a new one. :-)

Best of luck @zxystd! I'll watch the other repos as well, just in case if there's an issue I can answer.