Bug 203610 - [patch][asmc] Patch for MacBookAir,5.2 to control backlight
Summary: [patch][asmc] Patch for MacBookAir,5.2 to control backlight
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 10.2-RELEASE
Hardware: amd64 Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2015-10-07 11:20 UTC by Yuichiro NAITO
Modified: 2016-08-24 17:16 UTC (History)
3 users (show)

See Also:


Attachments
[patch] asmc(4) (1.59 KB, patch)
2015-10-07 11:20 UTC, Yuichiro NAITO
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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) ASMC_SMS_FUNCS_DISABLED
  (2) ASMC_FAN_FUNCS2

(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

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

  This patch adds support for restoring backlight after resume and adds models
  Macbook3,1
  MacbookAir5,1
  MacbookAir5,2

  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>

Changes:
  head/sys/dev/asmc/asmc.c
  head/sys/dev/asmc/asmcvar.h
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.