Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mbp15 branch - Touch bar works but doesn't visually change the fn-mode when FN key is pressed (since kernel 5.6.7) #46

Open
mfvianna opened this issue May 13, 2020 · 6 comments

Comments

@mfvianna
Copy link

mfvianna commented May 13, 2020

I'm using the mbp15 branch.
Until kernel 5.6.6, the module works well (except that sometimes it doesn't refresh the touchbar visually when the fn key is pressed or released - I opened another issue for that #44).

Since kernel 5.6.7 (tested 5.6.7, 5.6.8 and 5.6.11), the module compiles well, does enable the touch bar but it never visually changes the touch bar (although the meaning of the keys does change when the FN key is pressed or released)
In this case, from kernels >=5.6.7, an error message is generated in dmesg every time the fn key is pressed or released (after 2 secs):

[ 261.659012] apple-ib-touchbar 0003:05AC:8302.0007: tb: Failed to set touch bar mode to 2 (-110)

Update: In one boot (in dozens), it simply worked, so this should be something in the initialization. (the only time that it worked, the issue never happened, until I booted again... :-/)

@mfvianna mfvianna changed the title mbp15 branch - Touch bar works doesn't visually change the fn-mode when FN key is pressed (since kernel 5.6.7) mbp15 branch - Touch bar works but doesn't visually change the fn-mode when FN key is pressed (since kernel 5.6.7) May 13, 2020
@berrfred
Copy link

berrfred commented May 25, 2020

Same behaviour here on my mbp15 but it is still working properly with 5.6.7, then I updated to 5.6.13 and the described visual problem "appeared"... got it to work with 5.6.13 only once a couple of days ago and at the next boot the problem was there again.

apple-ib-touchbar 0003:05AC:8302.0007: tb: Failed to set touch bar mode to 2 (-110)

@mfvianna
Copy link
Author

@roadrunner2 , I'd like to help debug and fix this issue, that affects this branches for all kernel versions since 5.6.7, but I don't know where to start

@mfvianna
Copy link
Author

mfvianna commented Jun 21, 2020

I could not find the root cause so far, but I could find a workaround.
Some discoveries:

  • I've recompiled 5.6.6 and everything works, meaning the issue was not caused by any difference on the compilation environment (gcc version, headers, etc.);
  • After running 5.6.6 and removing the module before booting does make the touchbar to work on the next boot, even with 5.6.18;
  • Removing the module on 5.6.18 before booting may or may not work on the next boot: If this is in a working state and we remove the module before booting this will work on the next boot, if this is not in a working state, removing the module doesn't help the next boot;
  • Booting MacOS doesn't seem to help or change the "persistent across boots" working/not working state
  • Turnging off desn't seem to help or change the "persistent across boots" working/not working state

@roadrunner2 , could you please take a look at this issue or shed some light?

@berrfred , I set up a workaround that consists in removing the apple_ib_tb module before shutdown. For achieving that I created a simple systemd service that runs rmmod apple_ib_tb before shutdown/reboot. But for this to start working you will have to boot at least once in 5.6.6 so that the "persistent across boots" state gets activated. It seems that not removing the module puts the touchbar in a "locked" not working state. Booting 5.6.6 cleans it as long as you remove the module before rebooting. MacOS seems to be able to recover from this locked state but also seems to restore it as it got it before rebooting, so it doesn't serve as a state cleaner

OBS: issue #44, although similar, seems to be unrelated and is not fixed with this workaround.

@berrfred
Copy link

I could reproduce your workaround with 5.6.7 that has always been working for me:

  • booted into 5.6.7
  • sudo modprobe -r apple-ib-tb
  • either boot or restart with 5.6.15 (the latest kernel I have installed so far) and the touchbar properly works
  • as long as you keep unloading the driver before switching off, it keeps working at the next boot.

@mfvianna
Copy link
Author

mfvianna commented Jun 21, 2020

Since the module code is not documented and a have limited free time to investigate I could not yet find where the initialization and termination codes are or understand the meaning of each variable. Although I'm an experienced C developer, I'm not much familiarized with kernel coding.
I guess though, based on these recent discoveries, that there is some action in the termination code that could be added to the module initialization that could reset the touch bar and make it to work on all situations.

@SentToDevNull
Copy link

Here's some additional info for this bug. When apple-ib-tb isn't unloaded before reboot, triggering the bug, all keys on the touchpad work EXCEPT the XF86XK_Audio* keys (which aren't detected properly; tested with xev). It's pretty interesting behavior, so I thought I'd mention it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants