-
Notifications
You must be signed in to change notification settings - Fork 108
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
MacBook Pro 15+: iBridge Support #110
Comments
If folks could test the touchbar and light-sensor drivers on MacBookPro15,*, that would be very much appreciated. The driver is located at roadrunner2/macbook12-spi-driver (in the Once installed, could you please test the following:
|
yes
no, just stays ESC+brightness+multimedia
no, just stays ESC+brightness+multimedia
yes
yes
yes
couldn't get iio-sensor-proxy to work, so couldn't check |
Can confirm the same results as above. In addition, I tested the light sensor using the watch command and could see changes as I covered the sensor. |
Thanks to both of you for testing! Regarding the fn key issue: I think I found the problem and just pushed an update, so please re-pull. If it still doesn't work, then could you do two things:
Regarding the ALS: if the watch command works, then basically the driver is working, so that's good; |
@roadrunner2 just updated and tested. fn key still doesn't do anything. no errors in dmesg and the manual mode changes seem to work, not always but i'd say >95% of the time they work |
@wedgeV Let's first look at the fn key issue then, as having that working will make testing the mode changes much easier. So somehow I must have have the input-device id matching wrong - could you dump me some info on the input devices on your system? for inp in /sys/class/input/input* ; do cat $inp/name; grep . $inp/id/*; cat $inp/modalias; cat $inp/capabilities/key; echo ---; done |
/sys/class/input/input0/id/bustype:0019
/sys/class/input/input0/id/product:0005
/sys/class/input/input0/id/vendor:0000
/sys/class/input/input0/id/version:0000
input:b0019v0000p0005e0000-e0,5,kramlsfw0,
0
---
Power Button
/sys/class/input/input1/id/bustype:0019
/sys/class/input/input1/id/product:0001
/sys/class/input/input1/id/vendor:0000
/sys/class/input/input1/id/version:0000
input:b0019v0000p0001e0000-e0,1,k74,ramlsfw
10000000000000 0
---
HDA Intel PCH HDMI/DP,pcm=10
/sys/class/input/input10/id/bustype:0000
/sys/class/input/input10/id/product:0000
/sys/class/input/input10/id/vendor:0000
/sys/class/input/input10/id/version:0000
input:b0000v0000p0000e0000-e0,5,kramlsfw6,8,
0
---
Apple Headset
/sys/class/input/input11/id/bustype:0003
/sys/class/input/input11/id/product:5043
/sys/class/input/input11/id/vendor:05ac
/sys/class/input/input11/id/version:0101
input:b0003v05ACp5043e0101-e0,1,4,k72,73,A4,ram4,lsfw
1000000000 c000000000000 0
---
Apple Inc. Apple Internal Keyboard / Trackpad Keyboard
/sys/class/input/input12/id/bustype:0003
/sys/class/input/input12/id/product:027b
/sys/class/input/input12/id/vendor:05ac
/sys/class/input/input12/id/version:0101
input:b0003v05ACp027Be0101-e0,1,4,11,14,k71,72,73,74,75,77,79,7A,7B,7C,7D,7E,7F,80,81,82,83,84,85,86,87,88,89,8A,8C,8E,96,98,9E,9F,A1,A3,A4,A5,A6,AD,B0,B1,B2,B3,B4,B7,B8,B9,BA,BB,BC,BD,BE,BF,C0,C1,C2,F0,ram4,l0,1,2,3,4,sfw
1000000000007 ff9f207ac14057ff febeffdfffefffff fffffffffffffffe
---
Apple Inc. Apple Internal Keyboard / Trackpad Consumer Control
/sys/class/input/input13/id/bustype:0003
/sys/class/input/input13/id/product:027b
/sys/class/input/input13/id/vendor:05ac
/sys/class/input/input13/id/version:0101
input:b0003v05ACp027Be0101-e0,1,4,kA3,A4,A5,A8,D0,ram4,lsfw
10000 13800000000 0 0
---
Apple Inc. Apple Internal Keyboard / Trackpad Mouse
/sys/class/input/input16/id/bustype:0003
/sys/class/input/input16/id/product:027b
/sys/class/input/input16/id/vendor:05ac
/sys/class/input/input16/id/version:0101
input:b0003v05ACp027Be0101-e0,1,2,4,k110,111,112,r0,1,am4,lsfw
70000 0 0 0 0
---
Sleep Button
/sys/class/input/input2/id/bustype:0019
/sys/class/input/input2/id/product:0003
/sys/class/input/input2/id/vendor:0000
/sys/class/input/input2/id/version:0000
input:b0019v0000p0003e0000-e0,1,k8E,ramlsfw
4000 0 0
---
Apple Inc. iBridge Display
/sys/class/input/input20/id/bustype:0003
/sys/class/input/input20/id/product:8302
/sys/class/input/input20/id/vendor:05ac
/sys/class/input/input20/id/version:0101
input:b0003v05ACp8302e0101-e0,1,4,14,k71,72,73,78,A3,A4,A5,CC,E0,E1,E5,E6,F0,ram4,lsfw
1006300001000 3800000000 10e00000180001f f800000000000002
---
Power Button
/sys/class/input/input3/id/bustype:0019
/sys/class/input/input3/id/product:0001
/sys/class/input/input3/id/vendor:0000
/sys/class/input/input3/id/version:0000
input:b0019v0000p0001e0000-e0,1,k74,ramlsfw
10000000000000 0
---
PC Speaker
/sys/class/input/input4/id/bustype:0010
/sys/class/input/input4/id/product:0001
/sys/class/input/input4/id/vendor:001f
/sys/class/input/input4/id/version:0100
input:b0010v001Fp0001e0100-e0,12,kramls1,2,fw
0
---
Video Bus
/sys/class/input/input5/id/bustype:0019
/sys/class/input/input5/id/product:0006
/sys/class/input/input5/id/vendor:0000
/sys/class/input/input5/id/version:0000
input:b0019v0000p0006e0000-e0,1,kE0,E1,E3,F1,F2,F3,F4,F5,ramlsfw
3e000b00000000 0 0 0
---
HDA Intel PCH HDMI/DP,pcm=3
/sys/class/input/input6/id/bustype:0000
/sys/class/input/input6/id/product:0000
/sys/class/input/input6/id/vendor:0000
/sys/class/input/input6/id/version:0000
input:b0000v0000p0000e0000-e0,5,kramlsfw6,8,
0
---
HDA Intel PCH HDMI/DP,pcm=7
/sys/class/input/input7/id/bustype:0000
/sys/class/input/input7/id/product:0000
/sys/class/input/input7/id/vendor:0000
/sys/class/input/input7/id/version:0000
input:b0000v0000p0000e0000-e0,5,kramlsfw6,8,
0
---
HDA Intel PCH HDMI/DP,pcm=8
/sys/class/input/input8/id/bustype:0000
/sys/class/input/input8/id/product:0000
/sys/class/input/input8/id/vendor:0000
/sys/class/input/input8/id/version:0000
input:b0000v0000p0000e0000-e0,5,kramlsfw6,8,
0
---
HDA Intel PCH HDMI/DP,pcm=9
/sys/class/input/input9/id/bustype:0000
/sys/class/input/input9/id/product:0000
/sys/class/input/input9/id/vendor:0000
/sys/class/input/input9/id/version:0000
input:b0000v0000p0000e0000-e0,5,kramlsfw6,8,
0
--- |
Thanks, this clarifies things: the keybits are wonky, and that's because the relevant drivers don't know about the new usb id's, and hence aren't being loaded/attached. You can (temporarily) register the new id's as follows: sudo modprobe hid-apple
echo 3 05ac 027b 4 | sudo tee /sys/bus/hid/drivers/apple/new_id
sudo modprobe bcm5974
echo 05ac 027b | sudo tee /sys/bus/usb/drivers/bcm5974/new_id The touchbar driver may need to be reloaded after this, not sure. |
@wedgeV and @roadrunner2: I'm using the same patch #71 (comment) on my MacBookAir8,1 (2018 model with T2) and it works very well! If you have not compiled |
@wedgeV and @roadrunner2: I just fixed the FN issue on my MacBookAir8,1 keyboard by applying the following kernel patch: Linux 5.1.5 based patch to resolve keyboard FN key issues for
|
@ppaulweber cool, i'll try that! do you have two finger scrolling etc. working with the touchpad? |
@wedgeV you're welcome
Yes, everything works fine! You just really have to ensure that |
@ppaulweber can you share your linux and linux-headers packages (or a git repo that i can build it from)? i'm also on arch, currently using the packages from the repo someone shared on the main issue |
@wedgeV here you go https://github.com/ppaulweber/linux-mba, have fun and let me know if it works for you now |
@ppaulweber thanks so much! works, i now have scrolling/right click working! |
I would like to test and help, but i have some questions, i have the MBP13.3 2019 i7 Touch bar, currently on windows, i wiped out osx, had to inject drivers in win boot setup, as for linux, does the latest kernel have the SSD drivers ? or do i need to build custom kernel with it, then flash it over an USB ? |
Is keyboard backlight working for anybody? |
Good news, I got suspend working (sometimes, it's not reliable) and am working on pushing the code onto GitHub. As for reliability, the whole OS sometimes just doesn't wake up, makes it really hard to debug. |
Also it might be worthwhile to try to reverse engineer some of the XPC comms, so that one could try to take over the shitty fan control as I think it's the powerchime service managing it. |
I have pushed all the suspend related code for VHCI under the suspend branch: https://github.com/MCMrARM/mbp2018-bridge-drv/tree/suspend |
@axxapy (Commenting here since its related) The reason why the touchbar did not work out of the box is most likely due to the missing
|
Btw., sorry to ask again, but if anybody has the touchbar from my branch working as well as the patches to add the new id's to the |
@aunali1 I'm confused about your patches: why is the |
@roadrunner2 Disregard that, I was testing something for a non-T2 Macbook Pro. |
@aunali1 Ok, thanks. |
Went ahead and did some testing, here are my results:
Yes
Yes
Yes
Yes
Yes
Yep, works.
Works like a charm. |
well my driver is not providing any other functionality that bringing the USB hub up and providing audio support, so it definitely should not be handled by mine |
HID reports for setting up the backlight: https://mrarm.io/u/Paste%202019-08-28%2013-51-35.txt |
@roadrunner2 I've tried to test your latest changes: but apple-ib-tb.ko module is crashing during load time:
|
@mikeeq Thanks for the report - just pushed a fix. Btw., what model do you have? I'm trying to understand why it crashed for you but not for others. |
@roadrunner2 - Macbook Pro 15,2 13" 2019 i5 TouchBar Z0WQ000AR MV972ZE/A/R1 I can confirm that patched version is working ;) Will you have a minute to implement keyboard backlight to your ibridge driver? |
I'm working on patching the hid_apple driver to support backlight |
https://github.com/MCMrARM/mbp2018-etc/tree/master/apple-hid |
@MCMrARM are you able to change keyboard backlight brightness by pressing buttons on touchbar? but i can confirm that it's working for me - thanks Man. Good job, once again!
One thing @roadrunner2 with the latest version of |
@mikeeq no, I don't load the touchbar drivers during testing. But are they supposed to just work? I thought it's supposed to be handled by userspace. |
@mikeeq Does the following command return anything? for inp in /sys/class/input/input* ; do cat $inp/name; grep . $inp/id/*; cat $inp/modalias; echo ---; done | grep "Internal Keyboard" |
@aunali1 Yes it does.
And yeah @MCMrARM you were right - keyboard backlight brightness control after gnome restart is working for me both from GNOME settings gui and touchbar ;) |
@MCMrARM nice work on the keyboard backlight driver! Sorry, didn't have time to look at it myself. Looking over the report info you provided, I noticed that the descriptor of the report to set the brightness is not present in the list of report descriptors for that interface, only the descriptor for the brightness config A couple small things: the keyboard backlight doesn't turn unless the value is at least 32 (see backlight-min-on in the config) - in the applespi driver I therefore took the approach of scaling the given brightness values appropriately so that it turns on at value 1 (i.e. set-value = input-value / (max - min) * max). Something you might want to consider doing too. Also, I noticed that the max-brightness is 512, but in the kernel LED_FULL is defined as 255 - have you tested whether whether things like Gnome will actually scale their range between 0 to max, or assume max is always (at most) 255 (this can be tested by setting the keyboard brightness to max via the appropriate touchbar keys, and then looking at the actual brightness value in sysfs)? I.e. I'm wondering if it's necessary to set
The keyboard brightness keys are indeed just supposed to work; however, due to a bug in upower and gsd you usually have to restart upower ( |
Hmm, that's odd. Could you run a slightly modified version of what you ran at @aunali1 request above? for inp in /sys/class/input/input* ; do cat $inp/name; grep . $inp/id/*; cat $inp/capabilities/key; echo ---; done | grep -A5 "Internal Keyboard" I want to doubly confirm the FN key is being properly "exported" by the keyboard driver. Next, please apply the following patch to your --- a/apple-ib-tb.c
+++ b/apple-ib-tb.c
@@ -1130,6 +1130,10 @@ static bool appletb_match_internal_device(struct input_handler *handler,
strcmp(dev->type->name, "usb_device")))
dev = dev->parent;
+ pr_info("match-internal-dev: bustype=%x vendor=%x product=%x dev=%p usb-prod='%s'\n",
+ inp_dev->id.bustype, inp_dev->id.vendor, inp_dev->id.product,
+ dev, dev ? to_usb_device(dev)->product : "-");
+
/*
* Apple labels all their internal keyboards and trackpads as such,
* instead of maintaining an ever expanding list of product-id's we And then show me the output of |
As I said before FN switch is working properly on the previous version of the driver. On the new one besides switching everything works perfectly fine ;) |
@mikeeq Thanks. Aaargh: I managed to get the string-search test inverted! 🤦♂️ Just pushed the fix. |
Yep, it's working fine now - GJ @roadrunner2 ! Cheers ;) |
@roadrunner2 ah right, I didn't think of that. As for max_brightness it afaik should be fine, but I could verify it a bit later. Before upstreaming this patch I'll probably also want to get rid of the hardcoded constants in some places. |
* integrated patch provided by @MCMrARM to enable keyboard backlight for `MacBookPro15,x` and `MacBookAir8,x` as well * see: https://github.com/MCMrARM/mbp2018-etc/tree/master/apple-hid * see: Dunedan/mbp-2016-linux#110 (comment)
@MCMrARM thanks for the keyboard backlight patch, I was able to integrate this one along with the changes for the |
I have been working on some more of the Touch ID integration stuff.... |
@MCMrARM I think SEP (the other PCIe device) is absolutely involved in any enrollment/verification according to my rough inspection in IDA. |
As for credential set I have yet to figure out how it is obtained... The credentials are 16 bytes and change sometimes (sometimes are reused), unsure if it changes according to time or according to system reboots. |
Regarding Touch Bar, I have an implementation for Windows with media/volume control, "now playing" display, lock computer button and a few more thing (mostly Fn keys). It is possible to just use libusb for the usermode presentation component, which is not possible on Windows due to the design of the Apple VHCI Windows driver.
Usermode content host is implemented in .NET Core and Avalonia so it is possible to make it cross-platform (just remove some WinRT references and replace the IOCTL part with libusb transfers). C# haters can also implement it in other UI Framework and languages using these examples provided above (but that's out of my scope). |
@imbushuo I have a functioning DFR display daemon for linux that works using libusb and DBus for communicating system events (Power states, lock screen, etc.) The framework for drawing UI elements is based on Qt for now, not sure if thats the best option. Will be open sourcing it soon. |
I imagine if possible Gtk would be preferred, but I'm not sure if it has a flexible enough layout engine, so I didn't start working on anything. Qt is also ok, though Qt Quick I imagine? |
Is my understanding correct that the TouchBar of the 2018+ models is supported fine by https://github.com/roadrunner2/macbook12-spi-driver/ now and the backlight integration for these models got implemented in https://github.com/MCMrARM/mbp2018-etc/tree/master/apple-hid and is working fine as well? If yes, it'd be worth to point to the patched @MCMrARM: It'd be also great if you could get your changes upstreamed, so all users can benefit from them out-of-the-box. |
@aunali1 Any progress on open sourcing this? |
In case anyone finds this thread because they have installed the iBridge driver and got the touchbar working, but the As root, create the file
Make sure the values for
You can change the value of
Finally, you can test different settings:
|
Discussion and updates regarding iBridge related support. Parent thread is #71.
The text was updated successfully, but these errors were encountered: