Wednesday, March 23, 2016

The Other Shoe Drops...

<< Prev: Parsing Firmware       Next: Xcode vs. AppCode >>

The bad news is, I did more reading. I looked at more code, took more notes, read more background material. I'm becoming increasingly convinced my approach isn't going to work. If I try to rewrite all this code into C++, I'll never finish, and there probably won't even be decent progress (in terms of actually connecting to wireless networks) along the way. There's just too much -- driver code, PCIe interface code, MVM firmware interface code, 802.11 packet-handling code, and etc. I might be able to set up and initialize a card, but I can’t see that I'd actually be able to operate it.

Worse, all the simplifications I thought I'd make don't seem that simple. Rather than just dropping a couple files or functions because, for instance, no Mac has a hardware switch to disable wireless radios, the code for "RFKill" seems to be in little bits all over the place. Taking it out might be harder than leaving it in!

So I think I've been going about this backward. I think what I should be doing is attempting a minimal-changes type port, where I use the existing code to whatever extent is possible. Yes, I'll have to change some things I've already done, OK perhaps a lot of things I've already done, but maybe I'll find some shortcuts. Macros to work around missing Linux APIs or whatever.

In any case, I think that's maybe my only hope of achieving functionality in the not-amazingly-long term. Then once I get it all working, maybe that’s the time to think about migrating more code into C++ and making the organization more pleasing to me.

There will still be plenty of challenges, like the part where it expects the Linux wireless API to do something or other (such as give it connection settings for a network).

So really, the next step is just to sanity-check that option. Is it even reasonable to think I can fill all the gaps between Linux and OS X without a substantial rewrite? If I pull in ALL the iwlwifi driver code, and all the Linux headers they rely on for various structs and constants, can I get back to the working firmware loading-and-parsing code with the new strategy?

And if so, does it seem like a better or worse approach?

<< Prev: Parsing Firmware       Next: Xcode vs. AppCode >>

No comments:

Post a Comment