corpnewt / USBMap

Python script for mapping USB ports in macOS and creating a custom injector kext.
MIT License
1.04k stars 88 forks source link

Wrong ports number generation #7

Closed dima-lur closed 3 years ago

dima-lur commented 4 years ago

Снимок экрана 2020-03-18 в 20 12 29

Here discovered ports on my Z390 Aourus Ultra motherboard And generated kext mapped SS wrong (HS is right):

Снимок экрана 2020-03-18 в 20 14 50

SS03 should be 0x13000000

Juan-VC-gh commented 4 years ago

Seems to be an issue with all SS ports, happened to me as well with every SS port so manually changes the values

wordsnwood commented 4 years ago

Same problem. The SSxx ports were off by one. I document this in my reddit build post: https://www.reddit.com/r/hackintosh/comments/g5h4ty/opencore_057_asus_prime_z390p_radeon_rx580/

Found another person with same issue here: https://www.reddit.com/r/hackintosh/comments/g4cr8x/how_i_learned_to_stop_worrying_and_embrace/

Sorry, I do not know Python, but I'm guessing that there is an off-by-one issue with a loop or array somewhere that is causing this

ps: Asus Z390-P motherboard.

pchen43 commented 4 years ago

Not 100% sure but might have found a possible cause for the problem in USBMap.command in the function build_kext(). My mobo is an Asus z390-I.

If I understand correctly, each controller type (XHC, EH01, etc) gets its own count in key "top" which is converted to hex (line 551). The hex value is the value to the "port" key which ends up getting messed up for the SS ports for this issue and being off by one.

From the screenshot and talking with @wordsnwood , it seems like the commonality is a USR port with EH01 controller. I think this is what is causing the issue.

Looping through the sorted ports would encounter the HS ports first, then USR, then SS. So the HS ports count normally 1-14 and the "top" key is correct. Then the USR ports count as one for EH01 and one for XHC (at 15). Now, we get to SS so the XHC "top" increments 16-25.

I'm not sure for other cases but it ours, the USR port with EH01 controller should not be separated into its own count. If it was counted as XHC then there is no off by one error.

Like I said, I am not sure if this is the sure cause but I just wanted to point out what I noticed. Hopefully it's helpful!

corpnewt commented 3 years ago

This should no longer apply as the entirety of USBMap's codebase has been rewritten to gather the port numbers from the port's properties in ioreg.

-CorpNewt