asmc create new entry for macbook air 4,1

Hi

I have installed FreeBSD 11 on my 2011 Macbook Air 11 inch, model 4,1

I tried enabling asmc(4) in /boot/loader.conf but asmc(4) doesn't have an entry for the Macbook Air 4,1.

So it looks like I need to add an entry asmc.c but I can't find any documentation on what to do.

I installed smc fan control on my mac which gave me these stats
Code:
smc
52c
2001rpm
exuast 1994 rpm
The only post I have found about adding an new entry to asmc is this post on reddit

  • here are the steps posted on reddit

"Just run make from the */sys/modules/asmc/ directory of the source tree to (typically
/usr/src/sys/modules/asmc
) to build just the module.

Then you can make a backup copy of the current asmc.ko ( cp /boot/kernel/asmc.ko /boot/kernel/asmc.old), kldunload(8) module.

then load the module directly ( kldload /usr/src/sys/modules/asmc/asmc.ko) or copy it into the kernel folder in case it works fine, then it's ready for boot mode ( cp /usr/src/sys/modules/asmc/asmc.ko /boot/kernel/asmc.ko)."

from the reddit post it seems like these are the steps needed
  1. edit /boot/loader.conf and add asmc_load="yes"
  2. edit the asmc file and add a new entry
  3. backup up current asmc.ko
  4. unload the asmc module
  5. load the new module and test it
  6. then copy the module to /boot/kernel/asmc.ko
But I don't seem to have a /usr/src/sys directory and I can't find much documentation about adding your own entry to asmc.

If anyone could point me in the right direction would be greatly appreciated as my googling hasn't turned up much, and it's always better to get a proper opinion than relying on some random blog post.
 
Hi trev

after reading the handbook last night i realised i needed to install source in to /usr/src with subversion
i installed source with the command below


sudo svn checkout https://svn.freebsd.org/base/stable/11/ /usr/src


i now have the asmc files in /usr/src/sys/dev/asmc/

then i booted up mac osx on an external drive an installed smc fan control
i dumped the smc stats using the command below

  • change into the smcFanControl app resources directory

cd /Applications/smcFanControl.app/Contents/Resources

  • dump the smc stats to a text file on the Deskop

./smc -l > ~/Desktop/smc.txt

These are the smc stats for my Macbook Air 11inch 2011, model 4,1

Need to read up on how to use the stats to create an asmc entry next

Code:
#KEY  [ui32]  362 (bytes 00 00 01 6a)
  $Adr  [ui32]  768 (bytes 00 00 03 00)
  $Num  [ui8 ]  1 (bytes 01)
  +LKS  [flag]  (bytes 07)
  ACCL  [ui8 ]  0 (bytes 00)
  ACEN  [ui8 ]  1 (bytes 01)
  ACFP  [flag]  (bytes 01)
  ACIC  [ui16]  2944 (bytes 0b 80)
  ACID  [ch8*]  (bytes ba e5 2f 98 d0 02 10 b5)
  ACIN  [flag]  (bytes 01)
  ACLM  [ui8 ]  85 (bytes 55)
  AL!   [ui16]  0 (bytes 00 00)
  ALA0  [{ala]  (bytes ca 1e ff d6 02 d9)
  ALA1  [{ala]  (bytes 30 a4 02 1f 03 15)
  ALA2  [{ala]  (bytes 0c ea 02 d4 03 96)
  ALA3  [{ala]  (bytes 03 89 03 61 03 dc)
  ALA4  [{ala]  (bytes 00 ee 03 bc 04 00)
  ALA5  [{ala]  (bytes 04 fc ff f3 04 00)
  ALAT  [{alt]  (bytes 00 2b 03 08)
  ALCD  [fp88]  2.555 (bytes 02 8e)
  ALI0  [{ali]  (bytes 06 00 06 00)
  ALI1  [{ali]  (bytes 00 00 00 00)
  ALP0  [{alp]  (bytes 13 33 2d 00)
  ALP1  [{alp]  (bytes 00 00 00 00)
  ALRV  [ui16]  1 (bytes 00 01)
  ALSC  [{alc]  (bytes 00 c7 00 96 03 e8 00 0f 00 01 01 5e 1d 03 01 06)
  ALSF  [fp1f]  0.86401 (bytes 6e 98)
  ALSL  [ui16]  188 (bytes 00 bc)
  ALT0  [ui16]  0 (bytes 00 00)
  ALT1  [ui16]  0 (bytes 00 00)
  ALTH  [{alr]  (bytes 00 32 00 70 02 52 00 14 00 41)
  ALV0  [{alv]  (bytes 01 01 02 03 00 bb 00 2f 00 94)
  ALV1  [{alv]  (bytes 00 01 00 00 00 00 00 00 00 00)
  AUPO  [ui8 ]  0 (bytes 00)
  B0AC  [si16]  0 (bytes 00 00)
  B0AV  [ui16]  8316 (bytes 20 7c)
  B0Al  [ui16]  65535 (bytes ff ff)
  B0Am  [ui8 ]  16 (bytes 10)
  B0Ar  [ui8 ]  0 (bytes 00)
  B0As  [ui8 ]  0 (bytes 00)
  B0At  [ui16]  2400 (bytes 09 60)
  B0Au  [ui16]  2400 (bytes 09 60)
  B0BI  [hex_]  (bytes 51)
  B0CT  [ui16]  10 (bytes 00 0a)
  B0FC  [ui16]  4673 (bytes 12 41)
  B0LI  [ui16]  3328 (bytes 0d 00)
  B0PS  [hex_]  (bytes 00 00)
  B0RI  [ui16]  0 (bytes 00 00)
  B0RM  [ui16]  4557 (bytes 11 cd)
  B0St  [hex_]  (bytes 40 e0)
  B0TF  [ui16]  65535 (bytes ff ff)
  BATP  [flag]  (bytes 00)
  BBAD  [flag]  (bytes 00)
  BBIN  [flag]  (bytes 01)
  BC1V  [ui16]  4157 (bytes 10 3d)
  BC2V  [ui16]  4159 (bytes 10 3f)
  BCLM  [ui8 ]  100 (bytes 64)
  BCMV  [ui16]  4159 (bytes 10 3f)
  BEMB  [flag]  (bytes 01)
  BFCT  [ui16]  0 (bytes 00 00)
  BIMX  [ui16]  15182 (bytes 3b 4e)
  BIPD  [ui16]  0 (bytes 00 00)
  BITV  [ui16]  0 (bytes 00 00)
  BLPT  [ch8*]  (bytes 01 01 04 1a 0d b6 1f a0 00 00 00 00 00 00 00 00 00 00 00 00)
  BNCM  [ui8 ]  0 (bytes 00)
  BNCR  [ui8 ]  4 (bytes 04)
  BNum  [ui8 ]  1 (bytes 01)
  BRSC  [ui16]  98 (bytes 00 62)
  BSAC  [hex_]  (bytes 33)
  BSIn  [hex_]  (bytes 42)
  BTIL  [ui16]  1408 (bytes 05 80)
  BTTI  [ui8 ]  2 (bytes 02)
  BTVI  [ui8 ]  2 (bytes 02)
  BTVR  [ui8 ]  1 (bytes 01)
  BTVT  [ui8 ]  1 (bytes 01)
  BWLM  [ui8 ]  0 (bytes 00)
  CHBI  [ui16]  0 (bytes 00 00)
  CHBV  [ui16]  8400 (bytes 20 d0)
  CHGC  [ui16]  98 (bytes 00 62)
  CHGD  [flag]  (bytes 00)
  CHGI  [ui16]  0 (bytes 00 00)
  CHGV  [ui16]  8400 (bytes 20 d0)
  CHLC  [ui8 ]  2 (bytes 02)
  CLK!  [ui8 ]  0 (bytes 00)
  CLKC  [{clc]  (bytes 00 00 0e 10 00 00 0e 10 19 8c)
  CLKH  [{clh]  (bytes 00 00 70 80 00 01 19 40)
  CLKS  [fp1f]  1.00000 (bytes 80 00)
  CLKT  [ui32]  67012 (bytes 00 01 05 c4)
  CLSD  [ui16]  0 (bytes 00 00)
  CLWK  [ui16]  30 (bytes 00 1e)
  CRCB  [ui32]  2748993958 (bytes a3 da 51 a6)
  CRCU  [ui32]  3310152271 (bytes c5 4c ea 4f)
  DPB0  [ui8 ]  (bytes 0f)
  DPB1  [ui8 ]  (bytes 04)
  DPLM  [{lim]  (bytes 00 00 00 00)
  ECIA  [ui16]  0 (bytes 00 00)
  ECIM  [ui16]  0 (bytes 00 00)
  ECIO  [ui16]  0 (bytes 00 00)
  ECIP  [ch8*]  (bytes 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00)
  ECIT  [ui8 ]  0 (bytes 00)
  EPCA  [ui32]  28672 (bytes 00 00 70 00)
  EPCF  [flag]  (bytes 01)
  EPCI  [ui32]  103810816 (bytes 06 30 07 00)
  EPCV  [ui16]  1 (bytes 00 01)
  EPMA  [ch8*]  (bytes 00 00 60 80)
  EPMI  [ui8 ]  0 (bytes 00)
  EPUA  [ui32]  24576 (bytes 00 00 60 00)
  EPUF  [flag]  (bytes 01)
  EPUI  [ui32]  103809025 (bytes 06 30 00 01)
  EPUV  [ui16]  1 (bytes 00 01)
  EVCT  [ui16]  3341 (bytes 0d 0d)
  EVMD  [ui32]  0 (bytes 00 00 00 00)
  EVRD  [ch8*]  (bytes f6 06 03 00 00 40 0d 42 71 02 ff 00 01 40 00 00 71 05 72 00 13 40 b5 55 65 18 72 80 13 40 b5 55)
  F0Ac  [fpe2]  2003.50 (bytes 1f 4e)
  F0ID  [{fds]  (bytes 00 01 0a 00 45 78 68 61 75 73 74 20 20 00 00 00)
  F0Mn  [fpe2]  2000.00 (bytes 1f 40)
  F0Mt  [ui16]  0 (bytes 00 00)
  F0Mx  [fpe2]  6500.00 (bytes 65 90)
  F0Tg  [fpe2]  2000.00 (bytes 1f 40)
  FMAx  [fpe2]  2392.75 (bytes 25 63)
  FNum  [ui8 ]  1 (bytes 01)
  FPDc  [fp79]  18.5547 (bytes 25 1c)
  FPhz  [si16]  0 (bytes 00 00)
  FS!   [ui16]  0 (bytes 00 00)
  FSDc  [ui16]  0 (bytes 00 00)
  G3WD  [flag]  (bytes 00)
  HBKP  [ch8*]  (bytes 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00)
  HBKT  [ui32]  345600 (bytes 00 05 46 00)
  HBWK  [flag]  (bytes 00)
  HDBS  [ui8 ]  1 (bytes 01)
  HDST  [hex_]  (bytes 00 00 00 00)
  HDSW  [hex_]  (bytes 00 0c 00 0c)
  IB0P  [sp5a]  7.0000 (bytes 1c 00)
  IB0R  [sp5a]  0.2031 (bytes 00 d0)
  IC0C  [sp78]  0.340 (bytes 00 57)
  IC0R  [sp5a]  0.5586 (bytes 02 3c)
  IC1C  [sp5a]  0.0000 (bytes 00 00)
  IC1R  [sp5a]  0.6006 (bytes 02 67)
  IC1r  [ui16]  1968 (bytes 07 b0)
  ID0R  [sp5a]  0.8457 (bytes 03 62)
  IM0R  [sp5a]  0.3057 (bytes 01 39)
  IN0C  [sp5a]  0.1328 (bytes 00 88)
  IZAP  [sp5a]  0.0000 (bytes 00 00)
  IZBL  [sp5a]  0.0000 (bytes 00 00)
  IZHD  [sp5a]  0.0000 (bytes 00 00)
  KWS4  [ui8 ]  0 (bytes 00)
  LAcN  [ui8 ]  0 (bytes 00)
  LAtN  [ui16]  0 (bytes 00 00)
  LC2D  [ui16]  53829 (bytes d2 45)
  LC2E  [ui16]  53829 (bytes d2 45)
  LCCN  [ui8 ]  248 (bytes f8)
  LCCQ  [ui8 ]  223 (bytes df)
  LCKA  [ui8 ]  123 (bytes 7b)
  LCSA  [ui8 ]  145 (bytes 91)
  LCTN  [ui8 ]  63 (bytes 3f)
  LCTQ  [ui8 ]  111 (bytes 6f)
  LDEN  [ui16]  0 (bytes 00 00)
  LDI2  [ui8 ]  1 (bytes 01)
  LDS4  [ui8 ]  0 (bytes 00)
  LDSP  [flag]  (bytes 00)
  LDWE  [ui32]  0 (bytes 00 00 00 00)
  LKSB  [{lkb]  (bytes 00 00)
  MACA  [ui32]  0 (bytes 00 00 00 00)
  MACM  [flag]  (bytes 01)
  MACR  [ch8*]  (bytes 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00)
  MSAL  [ui8 ]  75 (bytes 4b)
  MSAc  [fp88]  0.000 (bytes 00 00)
  MSAf  [fp6a]  0.0000 (bytes 00 00)
  MSAg  [fp88]  0.000 (bytes 00 00)
  MSAm  [fp88]  0.000 (bytes 00 00)
  MSBC  [ui16]  0 (bytes 00 00)
  MSBP  [ui16]  3438 (bytes 0d 6e)
  MSBc  [ui16]  0 (bytes 00 00)
  MSBp  [ui16]  3438 (bytes 0d 6e)
  MSDW  [flag]  (bytes 00)
  MSG3  [flag]  (bytes 00)
  MSHT  [ui8 ]  0 (bytes 00)
  MSLB  [ui16]  0 (bytes 00 00)
  MSLC  [ui8 ]  0 (bytes 00)
  MSLD  [ui8 ]  0 (bytes 00)
  MSLF  [ui8 ]  0 (bytes 00)
  MSLG  [ui8 ]  0 (bytes 00)
  MSLP  [ui8 ]  0 (bytes 00)
  MSLT  [fp88]  11.000 (bytes 0b 00)
  MSPA  [fp6a]  0.0000 (bytes 00 00)
  MSPC  [ui8 ]  9 (bytes 09)
  MSPG  [ui8 ]  15 (bytes 0f)
  MSPM  [ui8 ]  4 (bytes 04)
  MSPS  [ui16]  3 (bytes 00 03)
  MSPs  [ui16]  0 (bytes 00 00)
  MSQA  [flag]  (bytes 00)
  MSQC  [ui8 ]  0 (bytes 00)
  MSQD  [si8 ]  0 (bytes 00)
  MSQF  [flag]  (bytes 00)
  MSQL  [ui8 ]  0 (bytes 00)
  MSSD  [si8 ]  5 (bytes 05)
  MSSE  [ui16]  0 (bytes 00 00)
  MSSF  [ui32]  0 (bytes 00 00 00 00)
  MSSG  [ui32]  0 (bytes 00 00 00 00)
  MSSP  [si8 ]  5 (bytes 05)
  MSSR  [flag]  (bytes 01)
  MSSS  [{mss]  (bytes 00)
  MSTC  [ui16]  0 (bytes 00 00)
  MSTM  [ui8 ]  1 (bytes 01)
  MSTS  [ui8 ]  7 (bytes 07)
  MSTc  [ui8 ]  0 (bytes 00)
  MSTf  [ui8 ]  0 (bytes 00)
  MSTg  [ui8 ]  0 (bytes 00)
  MSTm  [ui8 ]  0 (bytes 00)
  MSWA  [fp6a]  0.0000 (bytes 00 00)
  MSWE  [ui8 ]  (bytes 00)
  MSWF  [ui16]  1000 (bytes 03 e8)
  MSWO  [ui16]  1000 (bytes 03 e8)
  MSWP  [ui8 ]  (bytes 00)
  MSWR  [ui8 ]  0 (bytes 00)
  MSWr  [ui8 ]  0 (bytes 00)
  MSXC  [ch8*]  (bytes 00 00 00 00)
  MSXD  [ch8*]  (bytes 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00)
  MSXK  [ch8*]  (bytes 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19 1a 1b dc f0 f1 f2 f3)
  MSXN  [ui8 ]  33 (bytes 21)
  MSXS  [ch8*]  (bytes 01 02 03 04)
  MSXb  [ui8 ]  0 (bytes 00)
  MSXc  [ch8*]  (bytes 00 00 00 00)
  MSXd  [ch8*]  (bytes 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00)
  MSXk  [ch8*]  (bytes 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 dc dd de f0 f1 f2 f4 00)
  MSXm  [ui16]  8 (bytes 00 08)
  MSXn  [ui8 ]  31 (bytes 1f)
  MSXs  [ui32]  16909060 (bytes 01 02 03 04)
  MSa!  [ui8 ]  0 (bytes 00)
  MSac  [ui8 ]  0 (bytes 00)
  MSaf  [ui8 ]  0 (bytes 00)
  MSag  [ui8 ]  0 (bytes 00)
  MSam  [ui8 ]  0 (bytes 00)
  MSap  [ui8 ]  0 (bytes 00)
  MVDS  [flag]  (bytes 01)
  MVS4  [ui8 ]  0 (bytes 00)
  NACK  [ui8 ]  0 (bytes 00)
  NATJ  [ui8 ]  2 (bytes 02)
  NATi  [ui16]  27 (bytes 00 1b)
  NOPB  [ui8 ]  0 (bytes 00)
  NTOK  [ui8 ]  0 (bytes 00)
  ONMI  [ui8 ]  0 (bytes 00)
  PB0R  [sp78]  1.719 (bytes 01 b8)
  PC0C  [sp78]  2.355 (bytes 02 5b)
  PC0R  [sp78]  7.820 (bytes 07 d2)
  PC1C  [sp78]  0.000 (bytes 00 00)
  PC1R  [sp78]  8.914 (bytes 08 ea)
  PCP2  [sp78]  30.000 (bytes 1e 00)
  PCPC  [sp78]  2.855 (bytes 02 db)
  PCPG  [sp78]  0.098 (bytes 00 19)
  PCPL  [sp78]  17.000 (bytes 11 00)
  PCPT  [sp78]  5.879 (bytes 05 e1)
  PD0R  [sp78]  16.590 (bytes 10 97)
  PHPC  [sp78]  7.820 (bytes 07 d2)
  PM0R  [sp78]  0.637 (bytes 00 a3)
  PN0C  [sp78]  0.047 (bytes 00 0c)
  PTHC  [sp78]  28.000 (bytes 1c 00)
  PZAP  [sp78]  0.000 (bytes 00 00)
  PZBL  [sp78]  0.000 (bytes 00 00)
  PZHD  [sp78]  0.000 (bytes 00 00)
  Pz0F  [sp78]  28.000 (bytes 1c 00)
  Pz0S  [sp78]  28.000 (bytes 1c 00)
  RBr   [ch8*]  (bytes 6b 32 31 6b 37 38 00 00)
  REV   [{rev]  (bytes 01 74 0f 00 00 04)
  RMde  [char]  (bytes 41)
  RPlt  [ch8*]  (bytes 6b 37 38 00 00 00 00 00)
  RSvn  [ui32]  0 (bytes 00 00 00 00)
  RVBF  [{rev]  (bytes 01 74 0f 00 00 01)
  RVUF  [{rev]  (bytes 01 74 0f 00 00 01)
  SAS!  [hex_]  (bytes 00 00 ff ff)
  SBF   [hex_]  (bytes 00 00 00 00)
  SBFC  [flag]  (bytes 00)
  SBFD  [hex_]  (bytes 00 00 00 00)
  SBFE  [flag]  (bytes 01)
  SBFL  [hex_]  (bytes 00 00 00 00)
  SBFN  [hex_]  (bytes 00 00 00 00)
  SBFU  [hex_]  (bytes 00 00 00 00)
  SBS!  [ui16]  0 (bytes 00 00)
  SCIA  [ui16]  1016 (bytes 03 f8)
  SCII  [ui8 ]  0 (bytes 00)
  SCIL  [ui8 ]  0 (bytes 00)
  SCXC  [sp78]  100.000 (bytes 64 00)
  SDAF  [ui16]  0 (bytes 00 00)
  SDAS  [ui16]  0 (bytes 00 00)
  SDRd  [ui16]  0 (bytes 00 00)
  SFBR  [ui8 ]  4 (bytes 04)
  SIS!  [hex_]  (bytes 00 00)
  SIT!  [hex_]  (bytes 00 00)
  SIU!  [hex_]  (bytes 00 00)
  SMBC  [ch8*]  (bytes 00 00 00 00 00 00)
  SMBG  [ui8 ]  0 (bytes 00)
  SMBR  [ch8*]  (bytes 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00)
  SMBS  [ch8*]  (bytes 00 00)
  SMBW  [ch8*]  (bytes 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00)
  SPH0  [ui16]  0 (bytes 00 00)
  SPHR  [ui32]  0 (bytes 00 00 00 00)
  SPHS  [ui8 ]  0 (bytes 00)
  SPHT  [ui16]  0 (bytes 00 00)
  SPHZ  [ui8 ]  (bytes 00)
  SPS!  [hex_]  (bytes 00 00 00 00)
  SPT!  [hex_]  (bytes 00)
  SSD0  [ui16]  16384 (bytes 40 00)
  SWER  [hex_]  (bytes 00)
  Sp0P  [sp78]  0.000 (bytes 00 00)
  Sp0T  [sp78]  10.199 (bytes 0a 33)
  Sr0P  [sp78]  0.000 (bytes 00 00)
  Sr0T  [sp78]  42.000 (bytes 2a 00)
  Sr1P  [sp78]  0.000 (bytes 00 00)
  Sr1T  [sp78]  94.000 (bytes 5e 00)
  Sw0D  [sp78]  10.000 (bytes 0a 00)
  Sw0P  [sp78]  0.000 (bytes 00 00)
  Sw0T  [sp78]  47.000 (bytes 2f 00)
  Sw1D  [sp78]  10.000 (bytes 0a 00)
  Sw1P  [sp78]  0.000 (bytes 00 00)
  Sw1T  [sp78]  98.000 (bytes 62 00)
  Sw2D  [sp78]  10.000 (bytes 0a 00)
  Sw2P  [sp78]  0.000 (bytes 00 00)
  Sw2T  [sp78]  49.500 (bytes 31 80)
  Sw3D  [sp78]  10.000 (bytes 0a 00)
  Sw3P  [sp78]  0.000 (bytes 00 00)
  Sw3T  [sp78]  45.828 (bytes 2d d4)
  Sw4D  [sp78]  10.000 (bytes 0a 00)
  Sw4P  [sp78]  0.000 (bytes 00 00)
  Sw4T  [sp78]  45.828 (bytes 2d d4)
  TB0T  [sp78]  25.297 (bytes 19 4c)
  TB1T  [sp78]  25.297 (bytes 19 4c)
  TB2T  [sp78]  24.898 (bytes 18 e6)
  TC0C  [sp78]  55.312 (bytes 37 50)
  TC0D  [sp78]  49.625 (bytes 31 a0)
  TC0E  [sp78]  57.367 (bytes 39 5e)
  TC0F  [sp78]  59.621 (bytes 3b 9f)
  TC0P  [sp78]  46.000 (bytes 2e 00)
  TC1C  [sp78]  56.000 (bytes 38 00)
  TC2C  [sp78]  50.000 (bytes 32 00)
  TCGC  [sp78]  55.000 (bytes 37 00)
  TCSA  [sp78]  43.000 (bytes 2b 00)
  TH0F  [sp78]  -6.527 (bytes f9 79)
  TH0J  [sp78]  -7.000 (bytes f9 00)
  TH0O  [sp78]  -7.000 (bytes f9 00)
  TH0o  [hex_]  (bytes 07)
  THSP  [sp78]  38.125 (bytes 26 20)
  TM0P  [sp78]  41.875 (bytes 29 e0)
  TPCD  [sp78]  44.000 (bytes 2c 00)
  Ta0P  [sp78]  39.375 (bytes 27 60)
  Th1H  [sp78]  26.500 (bytes 1a 80)
  Tm0P  [sp78]  36.250 (bytes 24 40)
  Tm1P  [sp78]  38.250 (bytes 26 40)
  Ts0P  [sp78]  24.188 (bytes 18 30)
  Ts0S  [sp78]  27.867 (bytes 1b de)
  UPRC  [ui16]  2117 (bytes 08 45)
  VC0C  [sp5a]  0.8691 (bytes 03 7a)
  VC1R  [sp5a]  8.3789 (bytes 21 84)
  VC1r  [ui16]  22880 (bytes 59 60)
  VD0R  [sp5a]  14.5947 (bytes 3a 61)
  VN0C  [sp5a]  0.4512 (bytes 01 ce)
  VP0R  [sp5a]  8.3770 (bytes 21 82)
  WKEN  [ui8 ]  (bytes 00)
  WKTP  [ui8 ]  0 (bytes 00)
  WVr0  [ui8 ]  255 (bytes ff)
  WVw0  [ui8 ]  255 (bytes ff)
  zDBG  [ui8 ]  (bytes 00)
  zDSF  [flag]  (bytes 00)
 
Making progress

I have added a new entry for the macbook air 4,1 in asmc.c

Code:
    {
     "MacBookAir4,1", "Apple SMC Macbook Air 11-inch (Mid 2011)",
     ASMC_SMS_FUNCS_DISABLED,
     ASMC_FAN_FUNCS2, 
     ASMC_LIGHT_FUNCS,
     ASMC_MBA4_TEMPS, ASMC_MBA4_TEMPNAMES, ASMC_MBA4_TEMPDESCS
    },

and also added the temperatures to ASMC_MBA4_TEMPS

Code:
#define    ASMC_MBA4_TEMPS { "TB0T", "TB1T", "TB2T", "TC0C", \
                            "TC0D", "TC0E", "TC0F", "TC0P", \
                           "TC1C", "TC2C", "TCGC", "TCSA", \
                           "TH0F", "TH0J", "TH0O", "TH0o", \
                           "TM0P", "TPCD", "Ta0P", "Th1H", \
                           "Tm0P", "Tm1P", "Ts0P", "Ts0S" }

#define    ASMC_MBA4_TEMPNAMES { }

#define    ASMC_MBA4_TEMPDESCS { }

What i cant work out is how you get the TEMPNAMES and TEMPDESCS from the SMC code dumped from the mac

Is there somewhere you can find the smc entrys names for the physical hardware for the TEMPNAMES and TEMPDESCS

The entry for the macbook air 5,1 looks like this in asmcvar.h

Code:
#define    ASMC_MBA5_TEMPS        { "TB0T", "TB1T", "TB2T", "TC0C", \
                             "TC0D", "TC0E", "TC0F", "TC0P", \
                             "TC1C", "TC2C", "TCGC", "TCSA", \
                             "TCXC", "THSP", "TM0P", "TPCD", \
                             "Ta0P", "Th1H", "Tm0P", "Tm1P", \
                             "Ts0P", "Ts0S", NULL }

#define    ASMC_MBA5_TEMPNAMES    { "enclosure1", "enclosure2", "enclosure3", "TC0C", \
                             "cpudiode", "cputemp1", "cputemp2", "cpuproximity", \
                             "cpucore1", "cpucore2", "cpupeci", "pecisa", \
                             "TCXC", "THSP", "memorybank", "pchdie", \
                             "Ta0P", "heatpipe", "mainboardproximity1", "mainboardproximity2", \
                             "palmrest", "memoryproximity" }

#define    ASMC_MBA5_TEMPDESCS    { "Enclosure Bottom 1", "Enclosure Bottom 2", "Enclosure Bottom 3", "TC0C",\
                             "CPU Diode", "CPU Temp 1", "CPU Temp 2", "CPU Proximity", \
                             "CPU Core 1", "CPU Core 2", "CPU Peci Core", "PECI SA", \
                             "TCXC", "THSP", "Memory Bank A", "PCH Die", \
                             "Ta0P", "Heatpipe", "Mainboard Proximity 1", "Mainboard Proximity 2", \
                             "Palm Rest", "Memory Proximity" }
 
Eureka, managed to get asmc and keyboard backlight working on the macbook air 2011 11 inch model 4,1

Downloaded kernel source with subversion, patched the asmc file and built custom kernel ( thanks to rgrimes on freebsd irc channel )

Rebooted and now i have the backlit keyboard working on my macbook air 2011 11inch model 4,1
Ill do a full write up of how to install freebsd on the macbook air

first we need to dump the smc stats from the mac

boot up mac osx on an external drive an installed smc fan control
i dumped the smc stats using the command below

  • change into the smcFanControl app resources directory

cd /Applications/smcFanControl.app/Contents/Resources

  • dump the smc stats to a text file on the Deskop

./smc -l > ~/Desktop/smc.txt


Shutdown mac osx and boot into freebsd

  • checkout kernel source for freebsd 11

sudo svn checkout https://svn.freebsd.org/base/releng/11.0/ /usr/src

  • edit /usr/src/sys/dev/asmc/asmc.c
add new entry for macbook air 4,1

Code:
    {
     "MacBookAir4,1", "Apple SMC Macbook Air 11-inch (Mid 2011)",
     ASMC_SMS_FUNCS_DISABLED,
     ASMC_FAN_FUNCS2, 
     ASMC_LIGHT_FUNCS,
     ASMC_MBA4_TEMPS, ASMC_MBA4_TEMPNAMES, ASMC_MBA4_TEMPDESCS
    },

  • edit /usr/src/sys/dev/asmc/asmcvar.h
add the smc stats we dumped from the mac, you need to add NULL to the end of the array

Code:
#define    ASMC_MBA4_TEMPS { "TB0T", "TB1T", "TB2T", "TC0C", \
                            "TC0D", "TC0E", "TC0F", "TC0P", \
                           "TC1C", "TC2C", "TCGC", "TCSA", \
                           "TH0F", "TH0J", "TH0O", "TH0o", \
                           "TM0P", "TPCD", "Ta0P", "Th1H", \
                           "Tm0P", "Tm1P", "Ts0P", "Ts0S", \
                                NULL }

#define    ASMC_MBA4_TEMPNAMES { "TB0T", "TB1T", "TB2T", "TC0C", \
                                "TC0D", "TC0E", "TC0F", "TC0P", \
                               "TC1C", "TC2C", "TCGC", "TCSA", \
                               "TH0F", "TH0J", "TH0O", "TH0o", \
                               "TM0P", "TPCD", "Ta0P", "Th1H", \
                               "Tm0P", "Tm1P", "Ts0P", "Ts0S", \
                                NULL }

#define    ASMC_MBA4_TEMPDESCS { "TB0T", "TB1T", "TB2T", "TC0C", \
                                "TC0D", "TC0E", "TC0F", "TC0P", \
                               "TC1C", "TC2C", "TCGC", "TCSA", \
                               "TH0F", "TH0J", "TH0O", "TH0o", \
                               "TM0P", "TPCD", "Ta0P", "Th1H", \
                               "Tm0P", "Tm1P", "Ts0P", "Ts0S", \
                                NULL }

After editing the asmc files we can now build the custom kernel

first switch to root

sudo su

now we can build the custom kernel and new asmc module

cd /usr/src/sys/amd64/conf; config GENERIC; cd ../compile/GENERIC && make cleandepend && make depend && make -j 2 && make install

After the kernel is build we need to reboot

shutdown -r now


After rebooting we can check if the asmc module is working

sysctl dev.asmc

if everything worked you should now get a listing of all the asmc stats,
if you get unknown oid then its not working, i found i had to add NULL to the end of the array in asmcvar.h

turning on the keyboard backlight

sysctl dev.asmc.0.light.control:255

turning off the keyboard backlight

sysctl dev.asmc.0.light.control:255


many thanks to rgrimes on the freebsd irc channel for helping me figure out how to build a custom kernel with the pastched asmc files

ill do a full write up of how to install freebsd 11 on the macbook air over the weekend
 
Back
Top