Jump to content

GenericUSBXHCI USB 3.0 driver for OS X with source

xHC USB 3.0

  • Please log in to reply
613 replies to this topic

#41
nai22

nai22

    InsanelyMac Protégé

  • Members
  • Pip
  • 36 posts
since 1.1.3 sleep not working anymore, i went back to 1.1 and sleep works. ux32vd on ml 10.8.2. it goes to sleep, but wake up with a reboot, with 1.1 no problem at all

GenericUSBXHCI.kext;1.1.0;7 Series/C210 Series Chipset Family USB xHCI Host Controller;0c03

#42
Zenith432

Zenith432

    InsanelyMac Sage

  • Developers
  • 428 posts
  • Gender:Male

The _rootHub* fields are used without protection, even though they are only present in 10.7.5+.
The _onThunderbolt is accessed with protection in a couple of places (like the #if noted above), but others it is accessed without protection, even though only present on 10.7.2+.
The _externalDeviceCount is there in all versions (even 10.6.8).
What is the intention here? Thanks in advance...

There's no grand design there, just historical order of development. When I first ran into the thunderbolt code, I'd never done anything with thunderbolt before, so I went back and checked exactly which version it began.
For the _rootHub* fields, I looked in 10.7.5 and saw it's #ifdefed. I didn't know whether the distributed kexts were built with the symbols defined or not, so I stopped there and didn't look earlier.
In retrospect, 10.7.5 kexts were built with the symbols defined, so GenericUSBXHCI can be used with it.
OS 10.7.4 and earlier had no support for superspeed devices. So you won't be able to simply make them work. They can only be supported by simulation like PXHCD/mXHCD/Caldigit do, and it's a complicated simulation to develop. I explained in an earlier post why (slightly different descriptors from USB 2.0 to USB 3.0)
If you make enough of the code conditional, you can probably get it to manage USB 2.0 devices on xhci with OS 10.7.4 and earlier.
Note that in OS 10.6.8 some of the fields in IOUSBController, IOUSBControllerV2 were different, so it gets even more complicated...
If you want to check stuff into the repository, let me know.

Edited by Zenith432, 23 March 2013 - 08:55 PM.


#43
anibalin

anibalin

    InsanelyMac Sage

  • Members
  • PipPipPipPipPip
  • 276 posts
this worked great with a nec chipset pcie card:
[SubSystemVendorID]
059F
[SubSystemID]
0194
Thanks a lot for your work.

#44
RehabMan

RehabMan

    InsanelyMac Legend

  • Coders
  • 1,463 posts
  • Gender:Male
  • Location:Bellingham, WA
  • Interests:skiing, software, classic cars

There's no grand design there, just historical order of development. When I first ran into the thunderbolt code, I'd never done anything with thunderbolt before, so I went back and checked exactly which version it began.
For the _rootHub* fields, I looked in 10.7.5 and saw it's #ifdefed. I didn't know whether the distributed kexts were built with the symbols defined or not, so I stopped there and didn't look earlier.
In retrospect, 10.7.5 kexts were built with the symbols defined, so GenericUSBXHCI can be used with it.
OS 10.7.4 and earlier had no support for superspeed devices. So you won't be able to simply make them work. They can only be supported by simulation like PXHCD/mXHCD/Caldigit do, and it's a complicated simulation to develop. I explained in an earlier post why (slightly different descriptors from USB 2.0 to USB 3.0)
If you make enough of the code conditional, you can probably get it to manage USB 2.0 devices on xhci with OS 10.7.4 and earlier.
Note that in OS 10.6.8 some of the fields in IOUSBController, IOUSBControllerV2 were different, so it gets even more complicated...
If you want to check stuff into the repository, let me know.


My intention is not to make it work on 10.7.4 or prior, but I do want it to gracefully exit if installed...

What I've done with my repo is:
- removed the #if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1072 checks from V1Overrides.cpp and V1Pure.cpp
(because we are always on 10.7.5 or greater)
- set the OS X target to 10.7 (SDK is still 10.8)
- added this to GenericUSBXHCI.h:

#define MakeKernelVersion(maj,min,rev) (maj<<16|min<<8|rev)
#include <libkern/version.h>
#define GetKernelVersion() MakeKernelVersion(version_major,version_minor,version_revision)
- added a check in ::init to be sure driver doesn't start if prior to 10.7.5
// after call to super::init


    // do not load if prior to OS X 10.7.5
    if (GetKernelVersion() < MakeKernelVersion(11,4,2)) {
        IOLog("%s: Only 10.7.5 or greater is supported.\n", __FUNCTION__);
        return false;
    }

I've also optimized the build settings a bit to reduce the kext to 116 KB (binary is 114 KB). BTW, it looks like your Lion build might have debug symbols in it or something (256 KB). Mostly hiding symbols, turning LinkTime Optimize on, dead code elimination on, etc. With these options the only symbol exported is _kmod_info. You could get rid of all the __attribute__((visibility("hidden"))) using my build settings (I didn't bother as I didn't want to introduce huge diffs).

My fork is at: https://github.com/R...-X-Generic-USB3

Let me know if something I've done doesn't make sense... Thanks!

#45
Zenith432

Zenith432

    InsanelyMac Sage

  • Developers
  • 428 posts
  • Gender:Male

My intention is not to make it work on 10.7.4 or prior, but I do want it to gracefully exit if installed...

Info.plist asks for IOUSBFamily version 5.0.0a1 or later. So in fact it will gracefully not load at all on 10.7.4 or prior :)
A build compiled for min-version 10.7.5 with dual-arch should work on 10.8+, and a build compiled for min-version 10.8 (dual-arch) can functionally work on 10.7.5, but I'm not sure will load - ld may stick some load commands not supported in 10.7.5. This needs to be checked if important.

#46
RehabMan

RehabMan

    InsanelyMac Legend

  • Coders
  • 1,463 posts
  • Gender:Male
  • Location:Bellingham, WA
  • Interests:skiing, software, classic cars

Info.plist asks for IOUSBFamily version 5.0.0a1 or later. So in fact it will gracefully not load at all on 10.7.4 or prior :)


Good to know. I didn't even think to check that (I think because I saw the #ifs for 10.7.2...) I don't even have a 10.7.4 install to test, I was just wanting to be sure... Oh well, the code I added will handle the case that misguided soul decides to edit the Info.plist.

A build compiled for min-version 10.7.5 with dual-arch should work on 10.8+, and a build compiled for min-version 10.8 (dual-arch) can functionally work on 10.7.5, but I'm not sure will load - ld may stick some load commands not supported in 10.7.5. This needs to be checked if important.


Heh heh... I just realized that your kext does support 32-bit, which I don't really plan to use. Makes sense that your 10.7 build was dual-arch; mine won't be... I think I was getting confused between your usb3 and Meize's realtek driver, which won't build 32-bit... (working on both right now). I will update my README.md/project to reflect.

And yes, I don't know if there is any material difference between building w/ target set to 10.7 vs. 10.8. In theory, Apple should have their headers appropriately #ifdef, such that if say target '10.7' you can't accidentally use something that is not in 10.7. In practice, we know they are not that diligent with their SDK (I think they don't bother at all). kexts don't have the "Minimum system version' that apps do. Instead they have, as you say, the OSBundleLibraries dictionary. Whether ld sets something in the actual binary to indicate OS X target, I don't really know (but I think not).

Thanks!

#47
RehabMan

RehabMan

    InsanelyMac Legend

  • Coders
  • 1,463 posts
  • Gender:Male
  • Location:Bellingham, WA
  • Interests:skiing, software, classic cars
Zenith,

BTW, 10.7.5 is Darwin 11.4.2 (not 11.5)

see: http://en.wikipedia....Release_history
and for ML: http://en.wikipedia....Release_history

I think you will soon see why I used the MakeKernelVersion/GetKernelVersion macros... Yes, I saw your latest commit :-)

#48
Zenith432

Zenith432

    InsanelyMac Sage

  • Developers
  • 428 posts
  • Gender:Male
Ok, thanks, I'll make sure to correct it b4 another release.

#49
nai22

nai22

    InsanelyMac Protégé

  • Members
  • Pip
  • 36 posts
rev. 1.1.4 sleep and wake up is working now again. random kps also gone. thank you

#50
lisai9093

lisai9093

    InsanelyMac Geek

  • Members
  • PipPipPip
  • 122 posts
  • Gender:Male
Cannot sleep after using this kext. Console shows "Wake reason: XHCI". Was able to sleep without any problem with AppleUSBXHCI. I am using 7 series chipset. Any idea?

#51
bobstrike

bobstrike

    InsanelyMac Protégé

  • Members
  • Pip
  • 20 posts
  • Gender:Male
Hi Zenith432

I just want to say thank you for the amazing job.
With your kext I finally have a working machine with SuperSpeed 3.0 and audio from RME Fireface UCX (USB 2.0 for now) at the same time.
Great job.
Look forward to your next version improvements
Thank you !!! :thumbsup_anim:

#52
fe2babu

fe2babu

    InsanelyMac Protégé

  • Members
  • Pip
  • 1 posts
It can work for my Acer 3830TG (VID 1033, DEV 0194, rev 04) with ver 1.1.4 kext
However, sleep/wake issue occur(After wake up, Black screen).

As requested: the xhcdump caps and running output without kernel flags

Attached Files



#53
naiclub

naiclub

    InsanelyMac Geek

  • Members
  • PipPipPipPip
  • 191 posts
  • Gender:Male
  • Location:ThaiLand
  • Interests:Nuclear Fission+Galaxy
    http://www.youtube.com/watch?v=JVMlc4SgE5g
Wow SMedia ASM1042 USB 3.0 xHCI work with asus p8z77-v le plus. :thumbsup_anim:
Posted Image

#54
bebop68

bebop68

    InsanelyMac Protégé

  • Members
  • Pip
  • 23 posts
Is anyone having trouble downloading the binary? Mediafire seems to be on the blink but I've only tried over one 5 minute period.

#55
lollo78

lollo78

    InsanelyMac Protégé

  • Members
  • Pip
  • 22 posts
hi, if i boot with USB 3.0 HDD connected sometimes it's not mounted at startup. if i disconnect it and reconnect it appear on Desktop (but not always).
(Kext version 1.1.4)

#56
alexmaa

alexmaa

    InsanelyMac Protégé

  • Members
  • Pip
  • 2 posts
(1.1.4) sleep works on Gigabyte Z77-DS3H w/ integrated HD Graphics.
functionally USB3 to SATA OK but USB3 to IDE not working.

#57
YuTech

YuTech

    InsanelyMac Protégé

  • Members
  • Pip
  • 23 posts
Hello and Happy Easter to all :)
And especially for you Zenith432 a big thank you from the bottom of my heart! :)
I'm running Mountain Lion 10.8.3 on my HP Pavilion DV6 Notebook and my two USB 3.0 (Renesas) Slots are now working.
It tested my USB Mouse and my USB 2.0 HDD, both are working perfectly.

I have just two questions:

1. My sleep worked fine with the sleepenabler.kext, but now it doesn't work properly.
The sleep works like usual, but when I try to wake it up the screen remains black, I also tried darkwake=0, but it didn't help.
Is this a problem with the kext or maybe my DSDT?
Here is my DSDT:Attached File  DSDT.aml.zip   21.3KB   5 downloads

2. I have a USB Headset. The microphone and the headphones are working perfectly on the USB 2.0 slots.
When I plug it in one of the two USB 3.0 slots, the system recognizes the microphone and the Headphones but they won't work.
Is this a feature that is hard to add to your kext?

Again a big thank you :)

#58
krrkrr

krrkrr

    InsanelyMac Protégé

  • Members
  • Pip
  • 6 posts

Is anyone having trouble downloading the binary? Mediafire seems to be on the blink but I've only tried over one 5 minute period.


I got the same pb. It keeps saying there was pb ... and that the dl will restart. then, back to the first page and again...

#59
zoltankr

zoltankr

    zoliky

  • Members
  • PipPipPipPipPipPip
  • 427 posts
  • Gender:Male
I have two USB sound adapters (Behringer UCA 202 and C-Media). Both sound adapters are recognized, but neither work when plugged into USB3 ports (no sound output). I'm using GenericUSBXHCI v1.1.4 and OS X 10.8.3. The sound adapters work in USB2 ports.

Attached Files



#60
wyxz2008

wyxz2008

    InsanelyMac Protégé

  • Members
  • Pip
  • 15 posts

I have two USB sound adapters (Behringer UCA 202 and C-Media). Both sound adapters are recognized, but neither work when plugged into USB3 ports (no sound output). I'm using GenericUSBXHCI v1.1.4 and OS X 10.8.3. The sound adapters work in USB2 ports.


My sound adapter (creative audigy 2 nx) doesn't work too. Maybe it is because:

Limitations: Isochronous endpoints are not supported yet. This includes anything having to do with audio or video (webcams too.) If you try to connect devices with isoch endpoints, and OS X has an upper layer driver for the device, it'll fail to configure the device and you'll probably see some messages about it from IOUSBFamily in syslog.





Also tagged with one or more of these keywords: xHC, USB 3.0


4 user(s) are reading this topic

0 members, 4 guests, 0 anonymous users

© 2014 InsanelyMac  |   News  |   Forum  |   Downloads  |   OSx86 Wiki  |   Mac Netbook  |   PHP hosting by CatN  |   Designed by Ed Gain  |   Logo by irfan  |   Privacy Policy