Bug 203610

Summary: [patch][asmc] Patch for MacBookAir,5.2 to control backlight
Product: Base System Reporter: Yuichiro NAITO <naito.yuichiro>
Component: kernAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me CC: bradfanella, johalun0, pi, probono
Priority: --- Keywords: patch
Version: 10.2-RELEASE   
Hardware: amd64   
OS: Any   
Description Flags
[patch] asmc(4) none

Description Yuichiro NAITO 2015-10-07 11:20:27 UTC
Created attachment 161793 [details]
[patch] asmc(4)

I'm using MacBookAir 13" late 2012 model for FreeBSD 10.2-R.
UEFI boot works fine. Thanks for big effort of the feature.

I wrote a patch for asmc(4) to control keyboard backlight.

This patch adds model name entries used in the probe function.
I added following two #define symbols for the entries.


(1) is used to disable Sudden Motion Sensor(SMS).
MacBoookAir,5.2 doesn't have SMS.
asmc(4) must skip probing SMS.

(2) is another set of FAN functions.
MacBookAir,5.2 misses fan safe speed.

I tested on my MacbookAir.
And I think both 13" and 11" are same hardware,
MacBookAir,5.1 entry works on the same way.
Comment 1 Brad Fanella 2015-11-12 00:40:06 UTC
In a similar vein, I have patched the asmr.c driver myself and have confirmed it to be working on systems with the identifier "MacBookPro8,1"

SMS must also be disabled for this device. While keyboard backlight changes work, sysctl -a | grep asmc produces:

asmc0: asmc_key_read for key Tm0P failed ten times, giving up
Comment 2 commit-hook freebsd_committer 2016-05-02 19:15:38 UTC
A commit references this bug:

Author: adrian
Date: Mon May  2 19:15:17 UTC 2016
New revision: 298937
URL: https://svnweb.freebsd.org/changeset/base/298937

  [asmc] add support for more models and restore keyboard backlight after resume.

  This patch adds support for restoring backlight after resume and adds models

  It also incorporates fixes for bug #175260, bug #203610 and bug #203512
  so those can be closed if this patch is applied.

  PR:		kern/209156
  PR: kern/175260
  PR: kern/203610
  PR: kern/203512
  Submitted by:	Johannes Lundberg <johannes@brilliantservice.co.jp>

Comment 3 Yuichiro NAITO 2016-05-03 12:34:48 UTC
Thanks for the commit r298937.
It works fine on my MacbookAir 2012 model.
For FreeBSD 10.3 kernel, I changed kern_getenv to getenv and it's enough for me.
Why don't you plan to MFC ?
Comment 4 Johannes Lundberg 2016-08-24 17:06:47 UTC
Committed - fixed. 
Please close.
Comment 5 probono 2022-01-02 15:52:11 UTC
On Mac mini Mid 2010 (Macmini4,1) helloSystem 0.7.0 getting
asmc0: asmc_key_read for key F0Sf failed 10 times, giving up.

Does this model also lack fan safe speed?