Solved Macbook Pro backlit keyboard with asmc driver

n0de

New Member

Reaction score: 3
Messages: 2

I have been struggling to find a way to control the Macbook keyboard backlight brightness under FreeBSD. After stumbling across this man page, I enabled the asmc(4) kernel module and attempted to change some of the values using sysctl. However, there don't seem to be any MIBs related to smc:
Code:
# sysctl -a | grep smc
#
So my question becomes: is there a better way to go about setting the keyboard brightness, or is my Macbook model (13-inch, 2012) simply not supported by the kernel module?

Note: I'm using 10.1-RELEASE due to problems with Broadcom drivers in 10.2
 
OP
OP
n0de

n0de

New Member

Reaction score: 3
Messages: 2

By hacking around in the kernel source, I made the following changes (reflected in this patch) in /usr/src/sys/dev/asmc/asmc.c:
Code:
--- asmc.c    2014-11-11 14:02:57.000000000 -0600
+++ asmc.c    2015-11-11 12:50:43.000000000 -0600
@@ -197,6 +197,13 @@
     ASMC_MBP4_TEMPS, ASMC_MBP4_TEMPNAMES, ASMC_MBP4_TEMPDESCS
    },

+    {
+         "MacBookPro8,1", "Apple SMC MacBook Pro Core i5",
+     NULL, NULL, NULL,
+     ASMC_FAN_FUNCS, ASMC_LIGHT_FUNCS,
+     ASMC_MBP_TEMPS, ASMC_MBP_TEMPNAMES, ASMC_MBP_TEMPDESCS
+    },
+
    /* The Mac Mini has no SMS */
    {
     "Macmini1,1", "Apple SMC Mac Mini",
Note that this will only work for the Macbook Pro 2011 13-inch. You will need to find and replace your corresponding device identifier where I have "MacBookPro8,1". I haven't tested this on any other devices, but I assume there are many models that are technically supported but not included in the driver.

EDIT: make sure to recompile the kernel per the FreeBSD handbook, of course
 

wardbones

New Member


Messages: 3

This patch seems to work. I also added:

Code:
dev.asmc.0.light.control=100
to /etc/sysctl.conf and

Code:
asmc_load="YES"
to /boot/loader.conf
 

trev

Aspiring Daemon

Reaction score: 161
Messages: 781

Please open a PR on https://bugs.freebsd.org and include the patch or it will never be fixed. (I would but I don't have the relevant hardwrae and therefore can't provide a patch against the current file.)
 

trev

Aspiring Daemon

Reaction score: 161
Messages: 781

There are two patches available in Buzilla, already for my Macbook Pro 8,1 : https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=217505

Is there anything else I can do to get this in the next kernel?
The patch in the PR you referenced above was committed to head, stable-11 and stable-12 in December last year.

You don't mention what version of FreeBSD you're using, but if it is dated after last December, then it should already include the patch.
 
Top