Skip to content

Instantly share code, notes, and snippets.

@rockavoldy
Last active October 30, 2022 16:37
Show Gist options
  • Save rockavoldy/eeff232c932bf3eaa01b47c4d9253dd3 to your computer and use it in GitHub Desktop.
Save rockavoldy/eeff232c932bf3eaa01b47c4d9253dd3 to your computer and use it in GitHub Desktop.
(Maybe) better approach to get rid from rename _OSI to XOSI

SSDT-OSYS

This is (another) Windows spoofing patch to activate I2C over HID device for VoodooI2C work. The main different between _OSI to XOSI and SSDT-OSYS is this patch will be set global, so there is a chance to break your working trackpad as some laptop have more than one pointing devices in your DSDT and all of them will be activated and make VoodooI2C attached to wrong I2C Device.

DefinitionBlock ("", "SSDT", 2, "ACDT", "OSYS", 0)
{
External (LINX, IntObj)
External (OSYS, FieldUnitObj)
Scope (_SB)
{
Device (PCI1)
{
Name (_ADR, Zero) // _ADR: Address
Method (_INI, 0, NotSerialized) // _INI: Initialize
{
If (CondRefOf (\OSYS))
{
If (_OSI ("Linux"))
{
OSYS = 0x03E8
LINX = One
}
If (_OSI ("Windows 2001"))
{
OSYS = 0x07D1
}
If (_OSI ("Windows 2001 SP1"))
{
OSYS = 0x07D1
}
If (_OSI ("Windows 2001 SP2"))
{
OSYS = 0x07D2
}
If (_OSI ("Windows 2001.1"))
{
OSYS = 0x07D3
}
If (_OSI ("Windows 2006"))
{
OSYS = 0x07D6
}
If (_OSI ("Windows 2009"))
{
OSYS = 0x07D9
}
If (_OSI ("Windows 2012"))
{
OSYS = 0x07DC
}
If (_OSI ("Windows 2013"))
{
OSYS = 0x07DD
}
If (_OSI ("Windows 2015"))
{
OSYS = 0x07DF
}
If (_OSI ("Windows 2017"))
{
OSYS = 0x07E1
}
If (_OSI ("Windows 2018"))
{
OSYS = 0x07E2
}
If (_OSI ("Darwin"))
{
OSYS = 0x07DF
}
}
}
Method (_STA, 0, NotSerialized) // _STA: Status
{
If (_OSI ("Darwin"))
{
Return (0x0F)
}
Else
{
Return (Zero)
}
}
}
}
}
@kecinzer
Copy link

This looks promising, but it still doesn't work for me (after rename PCI1 to PCI0). Do I need anything else for this?

@rockavoldy
Copy link
Author

@kecinzer No need to rename anything, just disable patch _OSI to XOSI rename and SSDT-XOSI, and use this SSDT.
Maybe there is another cases where Device (PCI1) exists on original DSDT. Then need to rename PCI1 to another to avoid conflict

@kecinzer
Copy link

So when I have on my DSDT PCI0 I need to leave it as PCI1 in this file?

@kecinzer
Copy link

@rockavoldy Great! After I let this SSDT as is, touchpad is properly detected in IOREG and GenI2C, but not working at all. I don't know why. I tried clear kext cache, reboots, shut downs, but it still not working.

@rockavoldy
Copy link
Author

rockavoldy commented Jun 24, 2020

@kecinzer try with Polling mode first.. if it work, then next to GPIO Pinning in voodooi2c's documentation
GenI2C will help to generate patched SSDT for GPIO Pinning

@kecinzer
Copy link

@rockavoldy yes, it works with polling mode.
The point is, that I don't want to create any more patches and renames. With _OSI to XOSI rename and patch it works perfectly fine only with Windows spoofing without anything else, so I don't understand why I need create other patches with this method.
My final goal was create SSDT for touchpad, that works without any renames in ACPI.

@rockavoldy
Copy link
Author

@kecinzer can i see your unpatched DSDT? need to find out what OSYS value needed to enable GPI0 or HID I2C device
or you can try to change line 78 wtih 0x07E2 and going down. that value will be exist on DSDT, Device GPI0 or HID I2C Device

@kecinzer
Copy link

kecinzer commented Jun 25, 2020

Yes of course. Thank you a lot about help with it. This is really weird behavior. Because when I use this SSDT everything seems to works in IOREG or GenI2C. I can see that device is properly pinned, but touchpad simply not working.
I tried OSYS = 0x07DF and OSYS = 0x07E2. Result is still same. But it seems that variable is correctly set and device is pinned. I don't know why touchpad not working. I tried clear kext cachaes, several reboots. Nothing helped.

https://drive.google.com/file/d/1v_Kx_2Bvl-0YXcOXH9mUb5nqPke1mlnY/view?usp=sharing

properly-pinned

@rockavoldy
Copy link
Author

@kecinzer yeah, look OK for me.. have you tried using VoodooInput bundled inside PlugIns VoodooI2C? and is GPI0 device show in IOREG

@kecinzer
Copy link

Yes, I tried with bundled VoodooInput. GPI0 is shown correctly. I still don't understand, why it works like a charm in interrupt mode with this and _OSI to XOSI rename.
I can't see any difference in logs, IOREG etc.
If I understand correctly OSYS do basically the same like XOSI.

@rockavoldy
Copy link
Author

@kecinzer yeah, OSYS just another windows spoofing things
check again with kext, seems like VoodooI2C Satelite didn't loading properly

@kecinzer
Copy link

From where you get that VoodooI2C Satelite not loading properly? What I can try with KEXT?

@kecinzer
Copy link

@rockavoldy I compiled my own VoodooI2C version, but result is still same.

Snímek obrazovky 2020-06-25 v 12 52 06
Snímek obrazovky 2020-06-25 v 12 52 47
Snímek obrazovky 2020-06-25 v 12 53 43
Snímek obrazovky 2020-06-25 v 12 55 43

I can attach also my IOREG file.

@rockavoldy
Copy link
Author

From where you get that VoodooI2C Satelite not loading properly? What I can try with KEXT?

@kecinzer i tried mine with unloading VoodooI2CHID and the behavior same as your ioreg, touchpad device initiated but there is no I2C HID atached to that device

sorry i can't help you, i don't have device to figure it out

@kecinzer
Copy link

@rockavoldy I finaly found where si the problem. By accident I mentioned, that trackpad works after sleep. And then I found this _INI function:

`Method (_INI, 0, NotSerialized) // _INI: Initialize
{
If ((OSYS < 0x07DC))
{
SRXO (GPDI, One)
}

            INT1 = GNUM (GPDI)
            INT2 = INUM (GPDI)
            If ((SDM1 == Zero))
            {
                SHPO (GPDI, One)
            }

            HID2 = 0x20
            BADR = 0x2C
            SPED = 0x00061A80
        }`

Problem si SHPO (GPDI, One). When I created rename to XINI and made my custom Method without this condition, it works like a charm.
But I would like to do it without this renames. I tried set variable SDM1 = zero in SSDT, but it's not working, I don't know what I do wrong.
It's possible to make this variable preset?

I tried set SDM1 = zero in PCI1 _INI function, but without success. I tried put it in the () scope, but it still not working.
What is interesting is, that if I set SDM1 = One in PCI1 _INI function, trackpad works in polling mode.

@kecinzer
Copy link

kecinzer commented Jul 2, 2020

@rockavoldy I finaly found where is the problem with this solution!
This method sets OSYS variable, but this preset only works in method _CRS of my touchpad device, but not in method _INI, where is also needed. I don't know why and how to fix it with preset variable method, so I prepare pretty hard-core ACPI rename :).

@rockavoldy
Copy link
Author

@kecinzer this patch should be global, maybe other touchpad device in your DSDT initialized too when try to set SDM1 = zero, so there is many devices activated. Try to eliminate other devices

@kecinzer
Copy link

kecinzer commented Jul 3, 2020

@kecinzer this patch should be global, maybe other touchpad device in your DSDT initialized too when try to set SDM1 = zero, so there is many devices activated. Try to eliminate other devices

Yes, my laptop can have also touchscreen. Some people using my config reported that changing method from _OSI to XOSI breaks his touchscreen. So I thinking why is _OSI to XOSI method so bad? It seems to me more compatible and global.
So after many dreamless nights I return to day 0 solution using _OSI to XOSI rename and Windows spoofing.

@walechan
Copy link

walechan commented Jul 6, 2020

@kecinzer this patch should be global, maybe other touchpad device in your DSDT initialized too when try to set SDM1 = zero, so there is many devices activated. Try to eliminate other devices

Yes, my laptop can have also touchscreen. Some people using my config reported that changing method from _OSI to XOSI breaks his touchscreen. So I thinking why is _OSI to XOSI method so bad? It seems to me more compatible and global.
So after many dreamless nights I return to day 0 solution using _OSI to XOSI rename and Windows spoofing.

@kecinzer, I have been following your posts in few websites since our laptop DSDT are similar. I am using CLOVER and I tried hard coded in DSDT but no success with the touchpad. It returns i2c bus busy. I think that's related to pin rather than _OSI. I will try to figure it out in next few days and share my progress.

@kecinzer
Copy link

@walechan did you make any progress on it? After some time I still would like to switch from _OSI to XOSI rename :).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment