Jump to content
corsaro

Setup BCM43225 and customise WiFi key switch via DSDT

13 posts in this topic

Recommended Posts

Hi,

I'm trying to customise the WiFi toggle touch key that my HP Pavilion dv6-2193el (BCM43225 wifi controller with RehabMan's FakePCIID_Broadcom_WiFi kext) uses to enable/disable WiFi on OS X 10.11.5.

 

The problem is that the default behaviour of the switch is to disconnect from my current ssid and never reconnect to it. So I proceeded on patching my DSDT.

 

By using RehabMan's ACPIDebug, I found that this button triggers EC Query _Q15 event, so I proceeded to edit that Method.

 

Here is the original code extracted by Clover:

Method (_Q15, 0, NotSerialized)  // _Qxx: EC Query
{
    Store (0x15, P80H)
    Store (CMSR (0x49), WAB1)
    If (And (WAB1, 0x08))
    {
        And (WAB1, 0xF7, WAB1)
        Store (Zero, RFLE)
    }
    Else
    {
        Or (WAB1, 0x08, WAB1)
        If (LEqual (WAOK, Zero))
        {
            If (And (WBLC, One))
            {
                Store (One, RFLE)
            }
        }
    }

    If (LEqual (WAOK, Zero))
    {
        If (And (WAB1, 0x0A))
        {
            Or (WAB1, 0x02, WAB1)
            Or (WAB2, 0x02, WAB2)
            Or (WAB3, 0x02, WAB3)
        }
        Else
        {
            Or (WAB1, 0x0A, WAB1)
            Or (WAB2, 0x0A, WAB2)
            Or (WAB3, 0x0A, WAB3)
        }

        Or (WAB5, 0x08, WAB5)
        Or (WAB4, 0x08, WAB4)
    }
    Else
    {
        Store (0x07, WAB5)
        Store (Zero, WAB4)
        If (And (WAB1, 0x02))
        {
            Or (WAB4, One, WAB4)
        }

        If (And (WAB2, 0x02))
        {
            Or (WAB4, 0x02, WAB4)
        }

        If (And (WAB3, 0x02))
        {
            Or (WAB4, 0x04, WAB4)
        }
    }

    TRAP (TRTI, 0x20)
    If (LEqual (WAOK, One))
    {
        If (WA40)
        {
            Store (0x1B, ^^^^WMID.WEID)
        }
        Else
        {
            Store (0x05, ^^^^WMID.WEID)
        }

        Store (Zero, ^^^^WMID.WMED)
        Notify (WMID, 0x80)
    }
} 

I'm a newbie on DSDTs so what I thought was to provide a nice way to trigger a custom global service on OS X that could enable/disable wifi via networksetup. So I looked inside RehabMan's VoodooPS2Keyboard kext (I use it to enable and customise my keyboard) source code and I found a way to trigger the F13 button, in order to provide to Settings a button to bind my service.

 

First of all I replaced the Method with this code, just to try:

Method (_Q15, 0, NotSerialized) // WiFi Toggle
{
    Notify (PS2M, 0x0478) // Note: I have either PS2M and PS2K, but with PS2M brightness keys work
}

and I made a service (shell script) via Automator that could switch wifi, binding the F13 key (I think OS X doesn't use it(?)) to it through Settings app

if [ "$(networksetup -getairportpower en1 | grep -o 'On\|Off')" == "On"]; then
    networksetup -setairportpower en1 Off
else
    networksetup -setairportpower en1 On
fi

pretty self-explanatory.

Note: I use en1 because en0 is my ethernet card

 

That worked!... almost.

 

I lost the feature that the button's LED turns Blue when the connection is active or Red when it is inactive.

I tried to make numerous edits on the Method naïvely and tried to disable the default behaviour of disconnecting from the network. I didn't get the correct solution. I noticed that the code has three IF statements, so one of that controls the LED state, but I can't find the right statement neither I find the correct solution of throwing the PS2M event when there is other code (OS X throws me an error sound and I cannot understand why, neither system.log is reporting anything - when there is only the Notify call, the F13 key event and service are nominal)

 

My question: one of you experts could gently help me on understanding this code and make a functional and (possibly) optimised way of doing this? I'm sure that my method of calling a service via PS2 key event is not really the best one.

 

###

 

Another problem: during these numerous tests and reboots my WiFi controller stopped working. On OS X it says that it is Off and I can't turn it on. I tried to reinstall the kext, use the original DSDT, reinstall OS X... but nothing happened.

 

System.log reports this messages at every system startup:

kernel: AirPort: Link Down on en1. Reason 8 (Disassociated because station leaving).
kernel: en1::IO80211Interface::postMessage bssid changed
UserEventAgent: Captive: CNPluginHandler en1: Inactive
airportd: airportdProcessDLILEvent: en1 attached (down)

I tried to boot with Fedora (Linux) and WiFi doesn't work, same thing: it says that it's off and I can't turn it on.

 

My question: Did I "fried" my WiFi?

 

Solution: EC reset

 

###

Footnotes:

As always, English is not my madre lingua. Hope to be clear.

 

Thanks for your patience.

Edited by corsaro

Share this post


Link to post
Share on other sites
Advertisement

Maybe RFLE controls the state of the LED.  You should test it...

 

As for your "broken WiFi", you might try an EC reset.

Share this post


Link to post
Share on other sites

Dear RehabMan,

thanks for your quick response.

 

WiFi now works (I found a new "EFI" menu on HP and selected "Reset System" - the "classic" EC Reset method didn't work).

 

For the DSDT you are right, RFLE controls the state of the LED. Now the LED works.

But as I said before, when I touch the button, OS X throws me an error sound and the service is not triggered. System.log reports nothing about it.

 

This is the updated code:

Method (_Q15, 0, NotSerialized)  // WiFi Toggle
{
    Notify (PS2M, 0x0478)
    //Store (0x15, P80H)
    //Store (CMSR (0x49), WAB1)
    If (And (WAB1, 0x08))
    {
        And (WAB1, 0xF7, WAB1) // is this useful ?
        Store (Zero, RFLE)
    }
    Else
    {
        Or (WAB1, 0x08, WAB1) // is this useful ?
        If (LEqual (WAOK, Zero))
        {
            If (And (WBLC, One))
            {
                Store (One, RFLE)
            }
        }
    }
}

Share this post


Link to post
Share on other sites

 

Dear RehabMan,

thanks for your quick response.

 

WiFi now works (I found a new "EFI" menu on HP and selected "Reset System" - the "classic" EC Reset method didn't work).

 

For the DSDT you are right, RFLE controls the state of the LED. Now the LED works.

But as I said before, when I touch the button, OS X throws me an error sound and the service is not triggered. System.log reports nothing about it.

 

This is the updated code:

Method (_Q15, 0, NotSerialized)  // WiFi Toggle
{
    Notify (PS2M, 0x0478)
    //Store (0x15, P80H)
    //Store (CMSR (0x49), WAB1)
    If (And (WAB1, 0x08))
    {
        And (WAB1, 0xF7, WAB1) // is this useful ?
        Store (Zero, RFLE)
    }
    Else
    {
        Or (WAB1, 0x08, WAB1) // is this useful ?
        If (LEqual (WAOK, Zero))
        {
            If (And (WBLC, One))
            {
                Store (One, RFLE)
            }
        }
    }
}

 

I don't think 0x0478 makes any sense...

 

From ApplePS2ToADBMap.h:

 

0x68,   // 78  Keyboard Lang 3 (Japanese Katakana)

 

You were trying to send F13, right?....

 

 

0x69,   // 64  F13

Share this post


Link to post
Share on other sites

 

I don't think 0x0478 makes any sense...

 

From ApplePS2ToADBMap.h:

0x68,   // 78  Keyboard Lang 3 (Japanese Katakana)

You were trying to send F13, right?....

0x69,   // 64  F13

 

 

Oops, I forgot to say that I don't directly use ADB 0x69 but instead I'm calling e078 and then rebind it to 69 via VoodooPS2Keyboard kext.

 

This is because I don't know how to call from DSDT ADB 0x69 / how to calculate the hex to insert to the DSDT.

 

I tried 0x0464, 0x0064, 0x64, 0x0464 (via P2K, just because I don't know what's the difference between PS2K and PS2M) but nothing, I learned that '04' is related to '0e'.

Lastly I tried 0x0164 and that threw 64=69 (yay!), but OS X threw me error sound in repetition. Tried 0x0364 and OS X still threw me the error sound once.

 

Can you confirm that OS X doesn't use F13 key in some way? Maybe it triggers some function that is unavailable to me (although OS X should start the binded service)? Is there a known way to calculate the first 2 figures of the hex code? It's kinda weird to just edit here and there and reboot the system without knowing how to manage "the matter". Maybe I'm too lazy to continue googling in search for a documentation (I found useful only your posts and blog articles)

Share this post


Link to post
Share on other sites

Oops, I forgot to say that I don't directly use ADB 0x69 but instead I'm calling e078 and then rebind it to 69 via VoodooPS2Keyboard kext.

 

This is because I don't know how to call from DSDT ADB 0x69 / how to calculate the hex to insert to the DSDT.

 

I tried 0x0464, 0x0064, 0x64, 0x0464 (via P2K, just because I don't know what's the difference between PS2K and PS2M) but nothing, I learned that '04' is related to '0e'.

Lastly I tried 0x0164 and that threw 64=69 (yay!), but OS X threw me error sound in repetition. Tried 0x0364 and OS X still threw me the error sound once.

 

Can you confirm that OS X doesn't use F13 key in some way? Maybe it triggers some function that is unavailable to me (although OS X should start the binded service)? Is there a known way to calculate the first 2 figures of the hex code? It's kinda weird to just edit here and there and reboot the system without knowing how to manage "the matter". Maybe I'm too lazy to continue googling in search for a documentation (I found useful only your posts and blog articles)

 

You should use the debug VoodooPS2Controller.kext (or 'ioio -s ApplePS2Keyboard LogScanCodes 1') to verify your translations are happening as you expect.

Share this post


Link to post
Share on other sites

You should use the debug VoodooPS2Controller.kext (or 'ioio -s ApplePS2Keyboard LogScanCodes 1') to verify your translations are happening as you expect.

 That's what I did. Without it I couldn't verify keycodes and so describe this situation to you :-)

 

So I understand that this "brute forcing" is the only way. I can confirm that with 0x0164 and 0x0364 OS X throws me respectively error sound in repetition and error sound once and VoodooPS2Keyboard says respectively 64=69 and 64=69. That's F13 as I'm expecting.

 

UPDATE:

Tried with 0x036b (F20) and same thing, error sound but VoodooPS2Keyboard logs the key event.

Share this post


Link to post
Share on other sites

 That's what I did. Without it I couldn't verify keycodes and so describe this situation to you :-)

 

So I understand that this "brute forcing" is the only way. I can confirm that with 0x0164 and 0x0364 OS X throws me respectively error sound in repetition and error sound once and VoodooPS2Keyboard says respectively 64=69 and 64=69. That's F13 as I'm expecting.

 

UPDATE:

Tried with 0x036b (F20) and same thing, error sound but VoodooPS2Keyboard logs the key event.

 

Something must be wrong with the software at the other end (eg. not grabbing the keystroke).

Share this post


Link to post
Share on other sites

Something must be wrong with the software at the other end (eg. not grabbing the keystroke).

 

So what could be the solution? I can't think about another approach that involves no key events, or I'm too naive to think with a low-level mind. Maybe I have to study and make an ad-hoc kext?

Share this post


Link to post
Share on other sites

So what could be the solution? I can't think about another approach that involves no key events, or I'm too naive to think with a low-level mind. Maybe I have to study and make an ad-hoc kext?

 

Verify your key capture/binding method works with an actual key you can press.

Share this post


Link to post
Share on other sites

Verify your key capture/binding method works with an actual key you can press.

 

 

I tried to bind the service via CMD+F13 and it worked, although the LED and the key are not properly synchronised. (LED tends to ignore the first tap when the system loads up)

 

UPDATE:

I solved the sync (or I hope so) by placing the Notify call into the IF statement

Method (_Q15, 0, NotSerialized)  // WiFi Toggle
{
    //Store (0x15, P80H)
    //Store (CMSR (0x49), WAB1)
    If (And (WAB1, 0x08))
    {
        And (WAB1, 0xF7, WAB1)
        Store (Zero, RFLE)
        Notify (PS2M, 0x0364)
    }
    Else
    {
        Or (WAB1, 0x08, WAB1)
        If (LEqual (WAOK, Zero))
        {
            If (And (WBLC, One))
            {
                Store (One, RFLE)
                Notify (PS2M, 0x0364)
            }
        }
    }
} 

So now it's almost complete. I noticed that if I use e.g. CTRL+[WiFi Key] the LED doesn't change, but if I use CMD+[WiFi Key] or [WiFi Key] the LED changes. Maybe I can control this input via DSDT?

Edited by corsaro

Share this post


Link to post
Share on other sites

Back again.

 

I thought about another way of doing this thing, without PS2 key, and I finished on modifying ACPIDebug.kext to get notification from _Q15 with the new LED state attached, in order to synchronise it with the WiFi card state. The notification is OK and the report of the new state works nominally on system.log.

 

But I'm a newbie and I have one giant problem: how can I control the state of my WiFi card from the kext?

I tried to search around IO80211Family kext and I saw that it's closed source. So bad!

 

Is there a possible solution that I can implement?

 

Greetings.

Share this post


Link to post
Share on other sites

Regarding "frying" your Wi-Fi, this happened to me before I knocked off the Wi-Fi toggle in DSDT.

Just switch it on from Windows and reboot.

You might want to have a Windows To Go install on a USB hard drive or something for the purpose, or even an install on a 10 GB partition ...

 

I was thinking ...

Why do you use FakePCIID for injecting your Wi-Fi?

Mine (BCM43324 though) is injected via DSDT in a ARPT device.

A DSDT injection tends to be cleaner than a multitude of kexts ...

Regarding "frying" your Wi-Fi, this happened to me before I knocked off the Wi-Fi toggle in DSDT.

Just switch it on from Windows and reboot.

You might want to have a Windows To Go install on a USB hard drive or something for the purpose, or even an install on a 10 GB partition ...

 

I was thinking ...

Why do you use FakePCIID for injecting your Wi-Fi?

Mine (BCM43324 though) is injected via DSDT in a ARPT device.

A DSDT injection tends to be cleaner than a multitude of kexts ...

 

Did you have any stroke of luck with your red/white Mute button?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By MaLd0n
      Install MacOS with Olarila Image, Step by Step, Install and Post Install  
      https://www.olarila.com/topic/5794-hackintosh-guide-install-macos-with-olarila-image-step-by-step-install-and-post-install-windows-or-mac/
          First... If you need DSDT edits for SkyLake, KabyLake or CoffeeLake... -Post your full Clover folder with original tables in Origin folder(Extract with F4 in Clover boot screen) -Post Ioreg, extract with Ioreg Explorer http://www.insanelymac.com/forum/index.php?app=core&module=attach&section=attach&attach_id=222606 -Run it, post files generated in your desktop http://www.insanelymac.com/forum/index.php?app=core&module=attach&section=attach&attach_id=222609  Installation   --Create a bootable copy of macOS Sierra Check out the link http://www.insanelymac.com/forum/files/file/559-flash-drive-maker/   --Create a bootable copy of macOS HighSierra Check out the link http://diskmakerx.com/   --Paste my EFI folder into EFI partition  EFI GA H110M-S2.zip     --Install Sierra/High Sierra and boot into system!   Post Installation   --Paste my EFI folder into EFI partition  EFI GA H110M-S2.zip     --Reboot and activate video!   -Nvidia WebDriver Sierra http://www.insanelymac.com/forum/topic/312525-nvidia-web-driver-updates-for-macos-sierra-update-07212017/ -Nvidia WebDriver High Sierra http://www.insanelymac.com/forum/topic/324195-nvidia-web-driver-updates-for-macos-high-sierra-update-10162017/ -Cuda http://www.insanelymac.com/forum/topic/302795-cuda-90214-is-out-update-10162017/   --DSDT My DSDT with Skylake patches DSDT.GA H110M-S2.zip   Patches -FIX ERRORS AND WARNINGS -HPET -SATA -DMAC -SLPB -DARWIN -LPC -XHCI -PLUGIN TYPE -HDAS to HDEF -HDEF -RTC -IRQs -SBUS -BUS1 -MCHC -ALS0 -SHUTDOWN -LAN -USBX -PMCR -EC -PNLF -HDMI   -Credits and thanks to the old and new people in the community who developed patches, kexts and bootloaders!   Slice, Kabyl, usr-sse2, jadran, Blackosx, dmazar, STLVNUB, pcj, apianti, JrCs, pene, FrodoKenny, skoczy, ycr.ru, Oscar09, xsmile, SoThOr, RehabMan, Download-Fritz, Zenit432, cecekpawon, Intel, Apple, Oracle, Chameleon Team, crazybirdy, Mieze, Mirone, Oldnapalm, netkas, Elconiglio, artut-pt, ErmaC, Pavo, Toleda, Master Chief and family, bcc9, The King, PMheart, Sherlocks, Micky1979, vit9696, vandroiy2013, Voodoo Team, Pike R. Alpha, lvs1974, Austere.J, CVad and many, many, many others!   We're all here to have fun and learn from each other!   ENJOY!  
    • By kylon
      A big thanks to wegface for teaching me a lot of things.
       
       
      Tested on Catalina 10.15.4 and Clover EFI 5104 (Catalina Patcher)
       
      Not Working:
      - realtek sd card reader (pm me if you have a fix)
       
      Notes:
      **CPU patches are disabled, if you are using a locked BIOS you must enable them**
       
      Clover EFI:
      - Install it in UEFI Mode and change your hdd partition table to GPT.
      - You will be able to install ANY OS in EFI mode, even if this pc does not support EFI at all! (No guide available for this)
       
      You will need:
      My unlocked BIOS (OPTIONAL) (here) Latest Clover config from CCE Bank (here) (asus k53sj-kylon) Rehabman Voodoo PS2 Controller (here) acidanthera AppleALC (here) acidanthera Lilu (here) acidanthera VirtualSMC (here) acidanthera SMCBatteryManager (here) acidanthera SMCLightSensor (here) acidanthera WhateverGreen (here) Mieze Realtek RTL8111 (here)
    • By Donw35
      Catalina update 10.15.4 without issues, make sure you update your kexts before hand and clover 5107
      Catalina update 10.15.3 without issues, make sure you update your kexts before hand.
      Catalina update 10.15.2 without issues, make sure you update your kexts before hand.
      Catalina update 10.15.1 without issue although you may have to make sure clover boots from the right partition.
      HP 840 G2/G3, working with OS X 10.15 Catalina, for this to work you will need the SSDT-ECUSBX.aml and place that  EFI/CLOVER/ACPI/Patched. 
      Make sure you remove Remove all patches about renaming acpi of EC or H_EC, revert all ACPI renaming in ACPI DSDT.
       
      My method to install OS X on the SSD from a working real Mac via SSD to USB converter. I then install Clover and add my kexts and set the config.plist
       
      Not working
      SD Card reader
      Finger Print device
       
      Working
      Video - screen looks better in OS X then it does in Windows 10
      Display port
      VGA port
      WiFi and BlueTooth working OOO using the below hack
      Battery status with Rehabman's DSDT patch
      Brightness controls
      Sounds - using VoodooHDA
      * Microphone - cannot turn it off or mute
      Keyboard backlight - controlled though BIOS anyways
      touchpad - using VoodooPS2Controller
      USB3 - this laptop has two on board only and I haven't test them using the docking station
      USB3.1 C
      Ethernet - using IntelMausiEthernet
      Sleep - kind of, closing the lid doesn't go to sleep but goes to sleep over time.
      Web Cam, works but I covered it up.
       
       

       
      SSDT-ECUSBX.aml
      CLOVER.zip
      CLOVER_HP_840_G3_02032020.zip
    • By sierra2600
      The laptop in question: Acer TravelMate 8472 TM8472 (Model: ZQ3) (refer to the "Spoiler" at the end if you want the machine specs)
       
      "So what are you bugging us for?" Good question, because I am usually an introvert and usually just keep looking for answers but I could not find some. Jumping to it...
      What does not work and I would like thoughts on:
      Bluetooth does not register, used to on previous installs (sorry, I did not pay attention to see if this was caused by me updating to 10.8.5 but that was necessary for the below functions) (It does not work in Debian either - Ignore) LAN and WLAN  - I have found Kexts (somewhere, I think I just lost them... dang it...) for the WLAN but I have yet to try them, nothing for the LAN I know this is cheating but I read that The NDISulator for FreeBSD (HINT HINT) is a port of NDISwrapper for Linux that runs Windows XP network drivers in Linux or BSD Brightness controls work from the middle down on the "Sun" brightness overlay, I got this far from following this: https://www.insanelymac.com/forum/topic/287133-guide-backlight-brightness-for-intel-80860046-1st-gen-hd-gma-5700mhd/ but I am kind of thinking of trying: https://www.insanelymac.com/forum/topic/287133-guide-backlight-brightness-for-intel-80860046-1st-gen-hd-gma-5700mhd/?do=findComment&comment=2214344 . My "magic number" is: 0xF        I used DSDTEditor in Windows, since I figured all the drivers are loaded, to extract the DSDT and compile something that somewhat works... Wake from sleep issue - I tried the above guide for that but I get a no backlit display and I can see that the cursor in the password field is not flashing when I use an external light source, but it will reboot when I press Ctrl + Alt + Power "button" (it is actually a slider) and then also clear my freaking CMOS right down to the clock... yeah I have the ACPI fix implmented and it usually works... DVD Player.app reports that no viable video device was found (personally I don't care about the DVD Player.app problem, just wanted to put that out there for the heck of it) The microphone port always sounds like it is going through a [dirty] guitar effects petal no matter what sliders are adjusted  
      Likely causes of:
      Bluetooth (BCM92046), WIFI (BCM943225HM) - So, I USED TO be able to turn on the WIFI from within Windows then reboot into Mac OS and have it work but I noticed recently that the indicator light for them turns off BEFORE it reboots now. When Windows or Android load, it lights up- "No... really, captain obvious?!"... anyways... working "No really Sherlock!" so OBVIOUSLY, the OS has to activate them... and preferably ignore the wireless switching button For the WIFI module, if you omit the 9 and HM in a search, results appear! Brightness - Will get reset to full "Bright light! Bright light!" when a "Load System Defaults" is applied from within the BIOS settings but like the WIFI and Bluetooth the OS will forcefully take control of it Microphone In sounding dirty - me being lazy with the audio drivers LAN (BCM57760) - I dunno...  when I search it, nothing comes up...  
      "How did you get this far?"
      Update the BIOS, this is oh so very important (refer to the battery section of the "Spoiler" for the reson) PLEASE BACKUP YOUR BIOS FIRST! PLUG THE MACHINE INTO THE AC ADAPTER/CHARGER! DO NOT FORCE THE COMPUTER TO SHUTDOWN NOR REMOVE THE BATTERY NOR UNPLUG IT FROM THE AC ADAPTER/CHARGER WHILE IT IS UPDATING! I WILL NOT BE HELD LIABLE FOR BRICKED MACHINES! So it will boot off of the (Niresh) Mac OS X 10.8 with no changes to anything "Awesome" but you may still need at least a USB mouse "Aww" If you have the option to remove the display drivers/kexts otherwise it will not to boot or not display If you forgot this, breathe "You think that's air your breathing?"... anyways... during the bootloader, go into single user mode [ -s ] and follow the on screen instructions to allow for modifying the files. You will want to PREFERABLY create a folder where Mac OS cannot read them and move the IntelHDGraphics Kexts into it You are likely going to need an external USB keyboard as well now that it is installed Now install the described Kexts in the "Spoiler" associated with the hardware to get more functionality and loose the USB HICs  
      Any help pertaining to the Bluetooth, WIFI, LAN, bizarre brightness and wake after sleep backlit display issue would be wonderful... Thank you for your time and I hope that I helped anyone else out with some of their own issues pertaining to the Acer TravelMate 8472 TM8472 ZQ3 no nVidia with i5 laptop...
      (Attached are non-modified extracted DSDT DSL and AML files "with errors according to DSDTEditor" for reference of the machine with a Phoenix BIOS version of 1.28 (07/20/2011))
      dsdt.aml
      dsdt.dsl
       
       
×