-
Notifications
You must be signed in to change notification settings - Fork 112
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
Init fixes and caps lock led support #14
Conversation
There were two issues here. First was the missing delays after each transaction. The value used here (100us) was derived from the 'spiCSDelay' value found in the DSDT (the value given there is 10, but with no units - experimentation found that 100us was the minimum value at which things were stable, so assuming the unit is 10us). This then removed the need for reducing the clock frequency, which in turn appears to fix slow keyboard issues on MacBook8,1 (2015 model). The second issue was an extra cs-change after sending the init message and before receiving the status. The code comment was actually correct, but the code didn't do what the comment said. Lastly, this introduces a separate buffer to receive the status response from the write.
The _DSM function for the spi device returns a structure with an spiCSDelay field, so we now use that value instead of the hardcoded one. Note that on all MacBook(Pro)'s tested so far (MacBook8,1, MacBook9,1, and MacBookPro13,*) the same value (10) is returned.
Otherwise they don't get displayed in dmesg until the next log message flushes the buffer.
Great! This looks good to me. I'm without my laptop for a little bit (screen issue getting fixed), so I can't test it out myself - but if you're satisfied, then I'm happy to merge it in. |
@cb22 I'm reasonably happy with the changes, but it would nevertheless be good if somebody could test them on a MacBook (8 or 9), in particular the caps-lock led functionality (the traces I based it off are from a MacBookPro13,* - it's quite likely they're the same on the MacBook's, but it's just not been tested there). |
Really awesome work. Hit the caps lock key multiple times today just to see the fancy LED light up. 😄 Looking at the diff the SPI init and the caps lock LED commands look pretty similar. Any idea if there are additional commands available? |
One probably pretty minor issue I noticed: When reloading the
|
@Dunedan Yes, the structure of the commands are quite similar - I've been able to deduce a few more things about the structures of the messages in general (e.g. I understand the 8-byte header now, and know how to detect and deal with continued messages, such as occur when more than 6 fingers are pressed), and plan to submit a pull to make use of that and do a little less black-magic bit banging. And in fact there are some other commands in the traces @tudorbarascu sent, but I haven't tried to see what they do. As to the error: hmm, errno 19 is |
Apologies for sending this in one pull request, but I'm too lazy to try and tear things apart. The two big features where are the fixes to make trackpad initialization reliable, and to toggle the caps-locks led. Besides that there are some cleanups/re-factorings that I hope are acceptable.
This should fix issues #6 and #3, and is also related to #9.