kiibohd / controller

Kiibohd Controller
GNU General Public License v3.0
807 stars 270 forks source link

Hexgears Gemini not working on macOS #371

Open verydanny opened 5 years ago

verydanny commented 5 years ago

Device:

OS:

Version:

Screen Shot 2019-11-11 at 9 33 24 PM

Reproduction Steps:

  1. Plug in keyboard
  2. Keyboard LEDs start flashing on and off
  3. Keyboard either starts working, or keeps flashing indefinitely.

Resulting Issue:

Keyboard does not function as intended. If it does work, it does so after anywhere from 15s to until I plug it out then back in again. This not a USB power issue. It doesn't work on powered hubs, or hubs directly on motherboard. I cleaned all USB-C ports with alcohol. I tried many different things.

It only works on 1 of the macs I own, but only after about 15s of the same glitchy LED flashing.

Here is a log of usb messages while it attempts to "connect" the keyboard, the keyboard is connected to the HS02 (High Speed 02 port):

$ log stream | grep -i usb
2019-11-12 02:37:11.572729+0000 0xfa8fb    Default     0x0                  0      0    kernel: (AppleUSBHostCompositeDevice) 038961.432895 AppleUSBCDCCompositeDevice@(null): AppleUSBHostCompositeDevice::ConfigureDevice: unable to set a configuration (0xe00002ed)
2019-11-12 02:37:13.793508+0000 0x131      Default     0x0                  0      0    kernel: (IOUSBHostFamily) 038963.653619 HS02@14200000: AppleUSBHostPort::forcePowerGated: kPowerStateSuspended completed with 0xe00002d6 after 1411ms
2019-11-12 02:37:14.119442+0000 0x80a      Default     0x0                  0      0    kernel: (AppleUSBXHCI) 038963.979528 HS02@14200000: AppleUSB20XHCIPort::resume: unexpected link state (PORTSC 0x0e4202a0)
2019-11-12 02:37:14.219777+0000 0x200      Default     0x0                  0      0    kernel: (IOUSBFamily) 038964.079885 Keyboard - Gemini_Dusk_Dawn PixelMap USB@14200000: AppleUSBDevice::start: failed to attach or start _deviceClient
2019-11-12 02:37:14.219844+0000 0x200      Default     0x0                  0      0    kernel: (IOUSBFamily) 038964.079952 AppleUSBLegacyRoot@(null): AppleUSBLegacyRoot::usbServiceCallGated: failed to attach or start legacy service
2019-11-12 02:37:17.589901+0000 0xfa969    Default     0x0                  0      0    kernel: (AppleUSBHostCompositeDevice) 038967.449939 AppleUSBCDCCompositeDevice@(null): AppleUSBHostCompositeDevice::ConfigureDevice: unable to set a configuration (0xe00002ed)
2019-11-12 02:37:22.197299+0000 0x131      Default     0x0                  0      0    kernel: (IOUSBHostFamily) 038972.057237 HS02@14200000: AppleUSBHostPort::forcePowerGated: kPowerStateSuspended completed with 0xe00002d6 after 1410ms
2019-11-12 02:37:22.298840+0000 0x74       Default     0x0                  0      0    kernel: Keyboard - Gemini_Dusk_Dawn PixelMap USB::handlePowerDomainDidChangeTo not in power tree
2019-11-12 02:37:28.001066+0000 0xfaa37    Default     0x0                  0      0    kernel: (AppleUSBHostCompositeDevice) 038977.860883 AppleUSBCDCCompositeDevice@(null): AppleUSBHostCompositeDevice::ConfigureDevice: unable to set a configuration (0xe00002ed)
2019-11-11 21:37:29.660037-0500 0x2fb      Default     0x0                  99     0    bluetoothd: (IOBluetooth) USBProductID 0x828D   USBVendorID 0x5AC
2019-11-11 21:37:29.660532-0500 0x2fb      Default     0x0                  99     0    bluetoothd: (IOBluetooth) USBProductID 0x828D   USBVendorID 0x5AC
2019-11-12 02:37:30.220453+0000 0x131      Default     0x0                  0      0    kernel: (IOUSBHostFamily) 038980.080221 HS02@14200000: AppleUSBHostPort::forcePowerGated: kPowerStateSuspended completed with 0xe00002d6 after 1410ms
2019-11-12 02:37:36.118427+0000 0xfac1a    Default     0x0                  0      0    kernel: (AppleUSBHostCompositeDevice) 038985.978070 AppleUSBCDCCompositeDevice@(null): AppleUSBHostCompositeDevice::ConfigureDevice: unable to set a configuration (0xe00002ed)
2019-11-12 02:37:38.408831+0000 0x131      Default     0x0                  0      0    kernel: (IOUSBHostFamily) 038988.268424 IOUSBHostDevice@14200000: IOUSBHostDevice::start: failed to get device descriptor
2019-11-12 02:37:38.408965+0000 0x131      Default     0x0                  0      0    kernel: (AppleUSBXHCI) 038988.268561 HS02@14200000: AppleUSBXHCIPort::resetAndCreateDevice: failed to start device
2019-11-12 02:37:38.408973+0000 0x131      Default     0x0                  0      0    kernel: (AppleUSBXHCI) 038988.268570 HS02@14200000: AppleUSBXHCIPort::resetAndCreateDevice: failed to create device (0xe00002e9)
2019-11-12 02:37:38.409031+0000 0x80a      Error       0x0                  0      0    kernel: (IOUSBHostFamily) AppleUSBHostRequestCompleter::clearPipeStallThreadCall: clearStall for pipe <private> failed (0xe00002eb)
2019-11-12 02:37:38.409123+0000 0xfac1e    Default     0x0                  0      0    kernel: (AppleUSBHostCompositeDevice) 038988.268718 AppleUSBCDCCompositeDevice@(null): AppleUSBHostCompositeDevice::ConfigureDevice: unable to set a configuration (0xe00002ed)
2019-11-12 02:37:38.409128+0000 0xfa904    Error       0x0                  0      0    kernel: (IOUSBHostFamily) AppleUSBHostRequestCompleter::clearPipeStallThreadCall: clearStall for pipe <private> failed (0xe00002eb)
2019-11-12 02:37:38.409961+0000 0x74       Default     0x0                  0      0    kernel: Keyboard - Gemini_Dusk_Dawn PixelMap USB::handlePowerDomainDidChangeTo not in power tree
2019-11-12 02:37:41.566130+0000 0x74       Default     0x0                  0      0    kernel: Keyboard - Gemini_Dusk_Dawn PixelMap USB::handlePowerDomainDidChangeTo not in power tree
2019-11-12 02:37:43.957257+0000 0x131      Default     0x0                  0      0    kernel: (IOUSBHostFamily) 038993.816726 HS02@14200000: AppleUSBHostPort::forcePowerGated: kPowerStateSuspended completed with 0xe00002d6 after 1410ms
2019-11-12 02:37:46.419346+0000 0x131      Default     0x0                  0      0    kernel: (IOUSBHostFamily) 038996.278793 IOUSBHostDevice@14200000: IOUSBHostDevice::start: failed to get device descriptor
2019-11-12 02:37:46.419500+0000 0x131      Default     0x0                  0      0    kernel: (AppleUSBXHCI) 038996.278947 HS02@14200000: AppleUSBXHCIPort::resetAndCreateDevice: failed to start device
2019-11-12 02:37:46.419521+0000 0x131      Default     0x0                  0      0    kernel: (AppleUSBXHCI) 038996.278971 HS02@14200000: AppleUSBXHCIPort::resetAndCreateDevice: failed to create device (0xe00002e9)
2019-11-12 02:37:46.419643+0000 0xfac56    Default     0x0                  0      0    kernel: (AppleUSBHostCompositeDevice) 038996.279089 AppleUSBCDCCompositeDevice@(null): AppleUSBHostCompositeDevice::ConfigureDevice: unable to set a configuration (0xe00002ed)
2019-11-12 02:37:49.656235+0000 0xfacad    Default     0x0                  0      0    kernel: (AppleUSBHostCompositeDevice) 038999.515656 AppleUSBCDCCompositeDevice@(null): AppleUSBHostCompositeDevice::ConfigureDevice: unable to set a configuration (0xe00002ed)
2019-11-12 02:37:51.878429+0000 0x131      Default     0x0                  0      0    kernel: (IOUSBHostFamily) 039001.737827 HS02@14200000: AppleUSBHostPort::forcePowerGated: kPowerStateSuspended completed with 0xe00002d6 after 1412ms
2019-11-12 02:37:54.271995+0000 0x131      Default     0x0                  0      0    kernel: (IOUSBHostFamily) 039004.131357 HS02@14200000: AppleUSBHostPort::forcePowerGated: kPowerStateSuspended completed with 0x00000000 after 1412ms
2019-11-12 02:37:57.671337+0000 0xfaccb    Default     0x0                  0      0    kernel: (AppleUSBHostCompositeDevice) 039007.530667 AppleUSBCDCCompositeDevice@(null): AppleUSBHostCompositeDevice::ConfigureDevice: unable to set a configuration (0xe00002ed)
2019-11-12 02:37:59.891798+0000 0x131      Default     0x0                  0      0    kernel: (IOUSBHostFamily) 039009.751078 HS02@14200000: AppleUSBHostPort::forcePowerGated: kPowerStateSuspended completed with 0xe00002d6 after 1412ms
2019-11-12 02:38:00.228617+0000 0xfa99b    Default     0x0                  0      0    kernel: (AppleUSBXHCI) 039010.087905 HS02@14200000: AppleUSB20XHCIPort::resume: timeout waiting for U0
2019-11-12 02:38:00.228640+0000 0xfa99b    Default     0x0                  0      0    kernel: (AppleUSBXHCI) 039010.087931 HS02@14200000: AppleUSB20XHCIPort::resume: unexpected non-U0 link state (PORTSC 0x0e4202a0)
2019-11-12 02:38:00.239700+0000 0xfa99b    Default     0x0                  0      0    kernel: (AppleUSBXHCI) 039010.098987 HS02@14200000: AppleUSB20XHCIPort::resume: unexpected link state (PORTSC 0x0e4202a0)
2019-11-12 02:38:00.341075+0000 0xfa99b    Default     0x0                  0      0    kernel: (IOUSBFamily) 039010.200365 Keyboard - Gemini_Dusk_Dawn PixelMap USB@14200000: AppleUSBDevice::start: failed to attach or start _deviceClient
2019-11-12 02:38:00.341145+0000 0xfa99b    Default     0x0                  0      0    kernel: (IOUSBFamily) 039010.200435 AppleUSBLegacyRoot@(null): AppleUSBLegacyRoot::usbServiceCallGated: failed to attach or start legacy service
2019-11-12 02:38:06.178615+0000 0xfad2e    Default     0x0                  0      0    kernel: (AppleUSBHostCompositeDevice) 039016.037810 AppleUSBCDCCompositeDevice@(null): AppleUSBHostCompositeDevice::ConfigureDevice: unable to set a configuration (0xe00002ed)
2019-11-12 02:38:08.569869+0000 0xfad3b    Default     0x0                  0      0    kernel: (AppleUSBHostCompositeDevice) 039018.429024 AppleUSBCDCCompositeDevice@(null): AppleUSBHostCompositeDevice::ConfigureDevice: unable to set a configuration (0xe00002ed)
2019-11-12 02:38:11.699912+0000 0xfad78    Default     0x0                  0      0    kernel: (AppleUSBHostCompositeDevice) 039021.559009 AppleUSBCDCCompositeDevice@(null): AppleUSBHostCompositeDevice::ConfigureDevice: unable to set a configuration (0xe00002ed)
2019-11-12 02:38:16.313402+0000 0x131      Default     0x0                  0      0    kernel: (IOUSBHostFamily) 039026.172404 HS02@14200000: AppleUSBHostPort::forcePowerGated: kPowerStateSuspended completed with 0xe00002d6 after 1412ms
2019-11-12 02:38:19.716465+0000 0xfade1    Default     0x0                  0      0    kernel: (AppleUSBHostCompositeDevice) 039029.575411 AppleUSBCDCCompositeDevice@(null): AppleUSBHostCompositeDevice::ConfigureDevice: unable to set a configuration (0xe00002ed)
2019-11-12 02:38:24.500185+0000 0xfae18    Default     0x0                  0      0    kernel: (AppleUSBHostCompositeDevice) 039034.359037 AppleUSBCDCCompositeDevice@(null): AppleUSBHostCompositeDevice::ConfigureDevice: unable to set a configuration (0xe00002ed)
2019-11-12 02:38:27.734686+0000 0xfae2b    Default     0x0                  0      0    kernel: (AppleUSBHostCompositeDevice) 039037.593475 AppleUSBCDCCompositeDevice@(null): AppleUSBHostCompositeDevice::ConfigureDevice: unable to set a configuration (0xe00002ed)
2019-11-12 02:38:29.955642+0000 0x131      Default     0x0                  0      0    kernel: (IOUSBHostFamily) 039039.814359 HS02@14200000: AppleUSBHostPort::forcePowerGated: kPowerStateSuspended completed with 0xe00002d6 after 1412ms
2019-11-12 02:38:30.291700+0000 0x80a      Default     0x0                  0      0    kernel: (AppleUSBXHCI) 039040.150433 HS02@14200000: AppleUSB20XHCIPort::resume: timeout waiting for U0
2019-11-12 02:38:30.291725+0000 0x80a      Default     0x0                  0      0    kernel: (AppleUSBXHCI) 039040.150461 HS02@14200000: AppleUSB20XHCIPort::resume: unexpected non-U0 link state (PORTSC 0x0e4202a0)
2019-11-12 02:38:30.302010+0000 0x80a      Default     0x0                  0      0    kernel: (AppleUSBXHCI) 039040.160742 HS02@14200000: AppleUSB20XHCIPort::resume: unexpected link state (PORTSC 0x0e4202a0)
2019-11-12 02:38:30.402704+0000 0x80a      Default     0x0                  0      0    kernel: (IOUSBFamily) 039040.261406 Keyboard - Gemini_Dusk_Dawn PixelMap USB@14200000: AppleUSBDevice::start: failed to open _deviceClient
2019-11-12 02:38:30.402719+0000 0x80a      Default     0x0                  0      0    kernel: (IOUSBFamily) 039040.261455 AppleUSBLegacyRoot@(null): AppleUSBLegacyRoot::usbServiceCallGated: failed to attach or start legacy service
2019-11-12 02:38:30.403691+0000 0xfaea8    Default     0x0                  0      0    kernel: Keyboard - Gemini_Dusk_Dawn PixelMap USB: bad busy count (0,-1)
2019-11-12 02:38:33.744273+0000 0xfaeaa    Default     0x0                  0      0    kernel: (AppleUSBHostCompositeDevice) 039043.602939 AppleUSBCDCCompositeDevice@(null): AppleUSBHostCompositeDevice::ConfigureDevice: unable to set a configuration (0xe00002ed)
2019-11-12 02:38:35.965626+0000 0x74       Default     0x0                  0      0    kernel: Keyboard - Gemini_Dusk_Dawn PixelMap USB::handlePowerDomainDidChangeTo not in power tree
2019-11-12 02:38:38.358369+0000 0x131      Default     0x0                  0      0    kernel: (IOUSBHostFamily) 039048.216932 HS02@14200000: AppleUSBHostPort::forcePowerGated: kPowerStateSuspended completed with 0xe00002d6 after 1412ms
2019-11-12 02:38:41.763267+0000 0xfaec2    Default     0x0                  0      0    kernel: (AppleUSBHostCompositeDevice) 039051.621768 AppleUSBCDCCompositeDevice@(null): AppleUSBHostCompositeDevice::ConfigureDevice: unable to set a configuration (0xe00002ed)
2019-11-12 02:38:46.374294+0000 0x131      Default     0x0                  0      0    kernel: (IOUSBHostFamily) 039056.232696 HS02@14200000: AppleUSBHostPort::forcePowerGated: kPowerStateSuspended completed with 0xe00002d6 after 1411ms
2019-11-12 02:38:49.782173+0000 0xfafc3    Default     0x0                  0      0    kernel: (AppleUSBHostCompositeDevice) 039059.640508 AppleUSBCDCCompositeDevice@(null): AppleUSBHostCompositeDevice::ConfigureDevice: unable to set a configuration (0xe00002ed)
2019-11-12 02:38:54.394723+0000 0x131      Default     0x0                  0      0    kernel: (IOUSBHostFamily) 039064.252956 HS02@14200000: AppleUSBHostPort::forcePowerGated: kPowerStateSuspended completed with 0xe00002d6 after 1412ms
2019-11-12 02:38:57.798737+0000 0xfb008    Default     0x0                  0      0    kernel: (AppleUSBHostCompositeDevice) 039067.656904 AppleUSBCDCCompositeDevice@(null): AppleUSBHostCompositeDevice::ConfigureDevice: unable to set a configuration (0xe00002ed)
2019-11-12 02:39:00.018943+0000 0x131      Default     0x0                  0      0    kernel: (IOUSBHostFamily) 039069.877058 HS02@14200000: AppleUSBHostPort::forcePowerGated: kPowerStateSuspended completed with 0xe00002d6 after 1411ms
2019-11-12 02:39:00.355009+0000 0xfa99b    Default     0x0                  0      0    kernel: (AppleUSBXHCI) 039070.213119 HS02@14200000: AppleUSB20XHCIPort::resume: timeout waiting for U0
2019-11-12 02:39:00.355032+0000 0xfa99b    Default     0x0                  0      0    kernel: (AppleUSBXHCI) 039070.213146 HS02@14200000: AppleUSB20XHCIPort::resume: unexpected non-U0 link state (PORTSC 0x0e4202a0)
2019-11-12 02:39:00.366096+0000 0xfa99b    Default     0x0                  0      0    kernel: (AppleUSBXHCI) 039070.224206 HS02@14200000: AppleUSB20XHCIPort::resume: unexpected link state (PORTSC 0x0e4202a0)
2019-11-12 02:39:00.468553+0000 0xfa99b    Default     0x0                  0      0    kernel: (IOUSBFamily) 039070.326664 Keyboard - Gemini_Dusk_Dawn PixelMap USB@14200000: AppleUSBDevice::start: failed to attach or start _deviceClient
2019-11-12 02:39:00.468618+0000 0xfa99b    Default     0x0                  0      0    kernel: (IOUSBFamily) 039070.326730 AppleUSBLegacyRoot@(null): AppleUSBLegacyRoot::usbServiceCallGated: failed to attach or start legacy service
verydanny commented 5 years ago

Some more information:

It seems that when the keyboard is "attempting" to reconnect (it keeps detaching itself), it has something to do with figuring out the IOPowerManagement. No other device I have has issues with power. I power a small display through USB-C on my iMac.

I am using IORegistryExplorer from Apple's Additional Tools for Xcode 11 (https://developer.apple.com/download/more/) to get this info.

All attempted connections:

Screen Shot 2019-11-13 at 12 43 58 PM

I noticed that some of the connections have the IOPowerManagement property, but some do not:

Connection Attempt 1 (IOPowerManagement present):

Screen Shot 2019-11-13 at 12 45 11 PM

Connection Attempt 2 (IOPowerManagement missing):

Screen Shot 2019-11-13 at 12 45 21 PM

Connection Attempt 3 (IOPowerManagement missing):

Screen Shot 2019-11-13 at 12 45 28 PM

Connection Attempt 4 (IOPowerManagement missing):

Screen Shot 2019-11-13 at 12 46 20 PM

Connection Attempt 5 (IOPowerManagement present):

Screen Shot 2019-11-13 at 12 46 31 PM

al45tair commented 5 years ago

FWIW, it works fine on both my iMac and my MacBook Pro here. Well, modulo the other issues with the configurator software and so on.

If I had to guess, you've got a dicky cable somewhere; try changing to the other port, and try switching to a different USB-C cable. Also, try wiggling the cable.

verydanny commented 5 years ago

@al45tair

I've tried different cables and different ports, cleaning the ports, wiggling. It just doesn't wanna work.

al45tair commented 5 years ago

Did you flash the firmware, or is this with the stock firmware? (Stock firmware works OK here; if you try to generate firmware with the configurator, it may or may not work depending on what you try to do.)

al45tair commented 5 years ago

If you've flashed it and got it into this state, try clicking the "Standard" option on the layout menu, and use a paperclip to put the board into flash mode before clicking the Flash option.

verydanny commented 5 years ago

I've tried putting it into "Standard". I tested it stock, standard, etc.

It hasn't been doing anything but flashing on and off.

colingourlay commented 5 years ago

Getting exactly the same issue here on stock firmware and configuration, verified by running the same debug tools. My keyboard was fine for the first few days, then today I tried enabling some different lighting modes (using the 2nd layer FN keys) and it's started freaking out as described above.

colingourlay commented 4 years ago

Hey folks, I've just upgraded Mac OS to Catalina (10.15.2) and this issue has gone away entirely. No problems connecting my Hexgears Gemini Dusk; no problems entering/exiting flash mode or flashing a custom configuration. I've no idea what Apple's changed between major versions, but they seem to have fixed it!

haata commented 4 years ago

Yay! (Catalina has been pretty rocky, so this doesn't surprise me)