GithubHelp home page GithubHelp logo

entercloud-local-dev / macbook12-spi-driver Goto Github PK

View Code? Open in Web Editor NEW

This project forked from roadrunner2/macbook12-spi-driver

0.0 2.0 0.0 158 KB

WIP input driver for the SPI touchpad / keyboard found in the 12" MacBook (MacBook8,1 + MacBook9,1) and 2016 Macbook Pro (MacBookPro13,*); a Touchbar driver is also available.

License: GNU General Public License v2.0

Makefile 0.48% C 99.52%

macbook12-spi-driver's Introduction

Very simple, work in progress input driver for the SPI keyboard / trackpad found on 12" MacBooks, as well a simple touchbar driver for 2016 MacBook Pro's.

Using it:

To get this driver to work on a 2016 12" MacBook or a 2016 MacBook Pro, you'll need to boot the kernel with intremap=nosid if you're running a kernel before 4.11. Make sure you don't have noapic in your kernel options.

Additionally, you need to make sure the spi_pxa2xx_platform and intel_lpss_pci modules are loaded. This should result in the intel-lpss driver attaching itself to the SPI controller.

On the 2015 MacBook you currently need to (re)compile your kernel with CONFIG_X86_INTEL_LPSS=n.

DKMS module (Debian & co):

As root, do the following:

apt install dkms
git clone https://github.com/cb22/macbook12-spi-driver.git /usr/src/applespi-0.1
dkms install -m applespi -v 0.1

echo -e "\n# applespi\napplespi\nintel_lpss_pci\nspi_pxa2xx_platform" >> /etc/initramfs-tools/modules
update-initramfs -u

What works:

  • Basic Typing
  • FN keys
  • Driver unloading (no more hanging)
  • Basic touchpad functionality (even right click, handled by libinput)
  • MT touchpad functionality (two finger scroll, probably others)
  • Interrupts!
  • Suspend / resume

What doesn't work:

  • Key rollover (properly)
  • Wakeup on keypress / touchpad

Known bugs:

  • Occasionally, the SPI device can get itself into a state where it causes an interrupt storm. There should be a way of resetting it, or better yet avoiding this state altogether.

Interrupts:

Interrupts are now working! This means that the driver is no longer polled, and should no longer be a massive battery drain. For more information on how the driver receives interrupts, see the discussion here

Touchpad:

The touchpad protocol is the same as the bcm5974 driver. Perhaps there is a nice way of utilizing it? For now, bits of code have just been copy and pasted.

Touchbar:

The touchbar driver is called appletb. It provides basic functionality, enabling the touchbar and switching between modes based on the FN key. Furthermore the touchbar is automatically dimmed and later switched off if no (internal) keyboard, touchpad, or touchbar input is received for a period of time; any (internal) keyboard, touchpad, or touchbar input switches it back on.

The timeouts till the touchbar is dimmed and turned off can be changed via the idle_timeout and dim_timeout module params or sysfs attributes (/sys/class/input/input9/device/...); they default to 3min and 2.5min, respectively. See also modinfo appletb.

Debugging:

The debug module parameter can be used to turn debugging output on (and off) dynamically, and can be set in all the usual ways (e.g. via kernel command-line (applespi.debug=0x1), via sysfs (echo 0x10000 | sudo tee /sys/module/applespi/parameters/debug), etc.).

Some useful values are (since the value is a bitmask, these can be combined):

  • 0x10000 - determine touchpad values range
  • 0x1 - turn on logging of touchpad initialization packets
  • 0x6 - turn on logging of backlight and caps-lock-led packets

Some useful threads:

macbook12-spi-driver's People

Contributors

roadrunner2 avatar cb22 avatar christophgysin avatar sibradzic avatar cgutman avatar dunedan avatar l1k avatar

Watchers

James Cloos avatar Andrew Thompson  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.