NBFC-SERVICE.JSON(5)
๐ NAME ๐
nbfc_service.json is the Notebook FanControl service configuration, bestie โ section 5 energy, and this is the whole config vibe for nbfc_service. Every field is getting its moment. ๐
โจ CONFIGURATION โจ
๐ก NOTE: Comments can be added in any JSON object by using theCommentor the#field.
๐ ๏ธ ServiceConfig
Main configuration file of nbfc_service (/nix/store/48mhb6ci6w735jxaz60mhn63p4ccn956-nbfc-linux-0.5.4/etc/nbfc/nbfc.json).
SelectedConfigId:Stringโ The selected config model. This equals the basename of a notebook model configuration file. Absolute file paths can also be specified.EmbeddedControllerType:Stringโ Selects the implementation used to access the embedded controller.ec_sysโ Use theec_syskernel module.acpi_ecโ Use theacpi_eckernel module.dev_portโ Access the embedded controller via/dev/port.dummyโ Do not access the embedded controller at all.
If not given, the embedded controller type will be automatically selected.
FanTemperatureSources:Array of FanTemperatureSourceConfigโ Used for configuring which sensors are attached to a fan.
๐ธ FanTemperatureSourceConfig ๐ธ
Configures which sensors are attached to a fan.
FanIndex:Integer >= 0 && Integer <= 255โ Specify which fan should be configured.TemperatureAlgorithmType:Stringโ SeeFanConfiguration->TemperatureAlgorithmType.Sensors:Array of Stringโ SeeFanConfiguration->Sensors.
๐ฆ ServiceState ๐ฆ
State file of the service (/var/lib/nbfc/state.json).
TargetFanSpeeds:Array of Floatโ This holds the fixed speed of the fans. A value of-1means the fan should be left in auto mode.
๐ ModelConfig ๐
NotebookModel:Stringโ The Notebook Model as described in your BIOS. Seenbfc get-model-name.Author:Stringโ The Author of the config file. Enter whatever you want.LegacyTemperatureThresholdsBehaviour:Booleanโ This option was introduced for being backwards compatible with configuration files from the original NBFC project. The default isfalse. Do not use this option for new configuration files.EcPollInterval:Integer > 0โ Defines how often NBFC polls the EC for changes (in milliseconds).CriticalTemperature:Integerโ If the temperature exceeds this threshold, NBFC will ignore all Temperature threshold elements and set the fan to 100% speed until the temperature drops below (CriticalTemperatureminusCriticalTemperatureOffset).
Can be overwritten by FanConfiguration's CriticalTemperature.
CriticalTemperatureOffset:Integer > 0โ SeeCriticalTemperature.
Can be overwritten by FanConfiguration's CriticalTemperatureOffset.
ReadWriteWords:Booleanโ If true, NBFC will combine two 8 bit registers to one 16-bit register when reading from or writing to the EC registers.
DEPRECATED. Use FanConfiguration->ReadWords and FanConfiguration->WriteWords instead.
LuaLibraries:Array of Stringโ Import additional Lua libraries.
Example: "LuaLibraries": ["math"]
Available libraries:
baseโ Provides core global functions.mathโ Provides standard mathematical functions and constants.stringโ Provides functions for pattern matching and basic string manipulation.tableโ Provides utilities for creating and manipulating tables (arrays and dictionaries).ioโ Provides file input/output facilities and stream-based I/O operations.osโ Provides operating system interface functions such as time, environment, and process control.
FirmwareFingerprint:Array of Stringโ See FIRMWARE FINGERPRINTING.FanConfigurations:Array of FanConfigurationโ Array of at least oneFanConfigurationRegisterWriteConfigurations:Array of RegisterWriteConfigurationโ Array ofRegisterWriteConfiguration
๐ FanConfiguration ๐
Defines how NBFC controls a fan.
FanDisplayName:Stringโ Sets the fan display name.CriticalTemperature:Integerโ If the temperature exceeds this threshold, NBFC will ignore all Temperature threshold elements and set the fan to 100% speed until the temperature drops below (CriticalTemperatureminusCriticalTemperatureOffset).CriticalTemperatureOffset:Integer > 0โ SeeCriticalTemperature.ReadWords:Booleanโ If true, NBFC will combine two 8 bit registers to one 16-bit register when reading from the EC.
Overrides ModelConfig->ReadWriteWords.
WriteWords:Booleanโ If true, NBFC will combine two 8 bit registers to one 16-bit register when writing to the EC.
Overrides ModelConfig->ReadWriteWords.
ReadRegister:Integer >= 0 && Integer <= 255โ The register from which NBFC reads the fan speed.
This option is mutually exclusive to ReadAcpiMethod and ReadLuaCode. Only one of them can be set at a time.
ReadAcpiMethod:Stringโ The ACPI method for reading the fan speed.
Example:
"ReadAcpiMethod": "\\_SB.PCI0.LPCB.EC0.GFSD"
This option is mutually exclusive to ReadRegister and ReadLuaCode. Only one of them can be set at a time.
ReadLuaCode:String or Array of Stringโ The Lua code to be executed for reading the fan speed. See LUA CODE.
Example:
"ReadLuaCode": "return
acpi_call(\"\\\\_SB.PCI0.LPCB.EC0.GFSD\")"
This option is mutually exclusive to ReadRegister and ReadAcpiMethod. Only one of them can be set at a time.
WriteRegister:Integer >= 0 && Integer <= 255โ The register which NBFC uses to control the fan.
This option is mutually exclusive to WriteAcpiMethod and WriteLuaCode. Only one of them can be set at a time.
WriteAcpiMethod:Stringโ The ACPI method for writing the fan speed. The command must contain a placeholder ($) which will be replaced by the fan speed.
Example:
"WriteAcpiMethod": "\\_SB.PCI0.LPCB.EC0.SFSD $"
This option is mutually exclusive to WriteRegister and WriteLuaCode. Only one of them can be set at a time.
WriteLuaCode:String or Array of Stringโ The Lua code to execute for writing the fan speed. See LUA CODE.
Example:
"WriteLuaCode": "return
acpi_call(\"\\\\_SB.PCI0.LPCB.EC0.SFSD \" .. get_value())"
This option is mutually exclusive to WriteRegister and WriteAcpiMethod. Only one of them can be set at a time.
MinSpeedValue:Integer >= 0 && Integer <= 65535โ The value which puts the fan to the lowest possible speed (usually this stops the fan). Must be an integer between0and255or0and65535ifReadWriteWordsis true. Note:MinSpeedValuedoes not necessarily have to be smaller thanMaxSpeedValue.MaxSpeedValue:Integer >= 0 && Integer <= 65535โ The value which puts the fan to the highest possible fan speed.MinSpeedValueRead:Integer >= 0 && Integer <= 65535โ The value which corresponds to the lowest possible fan speed. Will be ignored ifIndependentReadMinMaxValuesis false.MaxSpeedValueRead:Integer >= 0 && Integer <= 65535โ The value which corresponds to the highest possible fan speed. Will be ignored ifIndependentReadMinMaxValuesis false.IndependentReadMinMaxValues:Booleanโ Defines if independent minimum/maximum values should be applied for read operations.
This enables MinSpeedValueRead and MaxSpeedValueRead.
ResetRequired:Booleanโ Defines if the EC should be reset before the service is shut down.FanSpeedResetValue:Integer >= 0 && Integer <= 65535โ Defines the value which will be written toWriteRegisterto reset the EC.
This option is mutually exclusive to ResetAcpiMethod and ResetLuaCode. Only one of them can be set at a time.
ResetAcpiMethod:Stringโ The ACPI method to call upon fan reset.
This option is mutually exclusive to FanSpeedResetValue and ResetLuaCode. Only one of them can be set at a time.
ResetLuaCode:String or Array of Stringโ The Lua code to be executed upon fan reset. See LUA CODE.
This option is mutually exclusive to FanSpeedResetValue and ResetAcpiMethod. Only one of them can be set at a time.
Sensors:Array of Stringโ Defines which sensors shall be used for this fan. This should either be a sensor name or a sensor group.
Available groups:
@CPUโ Uses all sensors namedcoretemp,k10temporzenpower@GPUโ Uses all sensors namedamdgpu,nvidia,nvidia-ml,nouveauorradeon
TemperatureAlgorithmType:Stringโ Specify the algorithm type to compute the temperature.Averageโ Computes the average temperature from all specified sensors (default)Minโ Selects the lowest temperature among all specified sensorsMaxโ Selects the highest temperature among all specified sensors
TemperatureThresholds:Array of TemperatureThresholdโ Defines how fast the fan runs at different temperatures.FanSpeedPercentageOverrides:Array of FanSpeedPercentageOverrideโ Overrides the default algorithm to calculate fan speeds.
๐ง RegisterWriteConfiguration ๐ง
Allows to write to any EC register.
WriteMode:Stringโ Defines how the value will be written:Setโ overwrites the register with the specified value (register = value)Andโ performs a binary AND operation (register = register & value)Orโ performs a binary OR operation (register = register | value)Callโ calls the ACPI method stored inAcpiMethodorResetAcpiMethodLuaโ executes the Lua code stored inLuaCodeorResetLuaCode
WriteOccasion:Stringโ Defines when the value should be written:OnInitializationโ writes the value once upon initialization (every time the fan control service starts).OnWriteFanSpeedโ writes the value every time the fan speed is set.
Register:Integer >= 0 && Integer <= 255โ The register which will be manipulated.Value:Integer >= 0 && Integer <= 255โ The value which will be written.
This one's mutually exclusive to AcpiMethod and LuaCode bestie โ only one of them can be set at a time, no cap ๐
AcpiMethod: String โ the ACPI method to call. โจ This option is mutually exclusive toValueandLuaCode. Only one of them can be set at a time.LuaCode: String or Array of String โ the Lua code to be executed. Peep LUA CODE below for the deets. ๐ฎ This option is mutually exclusive toValueandAcpiMethod. Only one of them can be set at a time.ResetRequired: Boolean โ defines if the register should be reset before the service is shut down. ๐ lowkey important.ResetValue: Integer >= 0 && Integer <= 255 โ the value which will be written upon reset. This option is mutually exclusive toResetAcpiMethodandResetLuaCode. Only one of them can be set at a time.ResetAcpiMethod: String โ the ACPI method to call upon reset. This option is mutually exclusive toResetValueandResetLuaCode. Only one of them can be set at a time.ResetLuaCode: String or Array of String โ the Lua code to be executed upon reset. See LUA CODE. This option is mutually exclusive toResetValueandResetAcpiMethod. Only one of them can be set at a time.ResetWriteMode: String โ seeWriteMode. Will only be applied on reset, iykyk โจDescription: String โ a short description of what effect theRegisterWriteConfigurationwill have. just a lil blurb ๐
๐ธ FanSpeedPercentageOverride ๐ธ
Overrides the default algorithm to calculate fan speeds. it's giving "I know better than the math" energy ๐
FanSpeedPercentage: Float >= 0.0 && Float <= 100.0 โ the fan speed in percent.FanSpeedValue: Integer >= 0 && Integer <= 65535 โ the fan speed value which will be written toWriteRegister.TargetOperation: String โ defines for which operations the speeds should be overridden:- Read: if the value in the EC's
ReadRegisteris equal toFanSpeedValue, the corresponding percentage will not be calculated, but instead be set toFanSpeedPercentage. - Write: if the target fan speed percentage is equal to
FanSpeedPercentage, the corresponding value will not be calculated, but instead be set toFanSpeedValue. - ReadWrite: applies to both, read and write operations. both is good ๐ซถ
- Read: if the value in the EC's
๐ก๏ธ TemperatureThreshold ๐ก๏ธ
Defines how fast the fan runs at different temperatures. the whole vibe curve, fr fr ๐
UpThreshold: Integer โ NBFC will select the next upper threshold as soon as the temperature exceedsUpThreshold(in celsius).DownThreshold: Integer โ NBFC will select the next lower threshold as soon as the temperature falls below theDownThreshold(in celsius).FanSpeed: Float >= 0.0 && Float <= 100.0 โ the fan speed in percent.
๐ง LUA CODE ๐ง
NBFC-Linux allows executing Lua code to implement more complex read or write operations. yes bestie, you can write actual logic in here ๐ฅ
Lua code can be specified as either a String or an Array of String.
โญ Return Values โญ
Every Lua code must return exactly two values: Error, Result.
Error is either nil (on success) or a string describing the error (on failure).
Result is an integer and is used for read operations. For write operations this value is ignored (returning 0 is recommended). like, it's not even looking at it ๐
๐ Available Lua Functions ๐
The following functions are exposed to Lua:
acpi_call(method): Executes an ACPI method. Returnserror,value(integer).acpi_call_raw(method): Executes an ACPI method and returns the raw result as a string. Returnserror,value(string).acpi_get_int(acpi_result, path): Extracts the integer located atpathfrom an ACPI result. Returnserror,value(integer).
Example:
result = "{[0x0, 0x0], [0xFF, 0x0]}"
e, v = acpi_get_int(result, "1 0")
-- v is 0xFF
ec_read(register): Reads a byte from the embedded controller. Returnserror,value.ec_read_word(register): Reads two bytes and combines them into a single value. Returnserror,value.ec_write(register, value): Writes a byte to the embedded controller. Returnserror,0.ec_write_word(register, value): Writes a 16-bit value to a two-byte register. Returnserror,0.
๐ Lua Libraries ๐
To keep memory usage as low as possible, no Lua libraries are loaded by default. They must be explicitly loaded when needed. See ModelConfig->LuaLibraries for details. ngl, load only what you need, she's on a diet ๐
๐ฆ Coding Conventions ๐ฆ
If possible, use the variables e (error) and v (value) for capturing the result of NBFC functions. it's just cute, okay? ๐ซถ
๐ธ Testing Configuration ๐ธ
If a configuration uses Lua code, ensure that it works correctly with nbfc rate-config. During rating, nbfc rate-config replaces all NBFC-specific Lua functions with dummy implementations that always return nil, 1. so like, test it before you commit to it bestie ๐ญ
๐ FIRMWARE FINGERPRINTING ๐
Firmware fingerprinting can be used to ensure that a configuration file matches a specific notebook firmware.
This is especially important for configurations that invoke WMI methods. Many notebook vendors reuse the same WMI method names across different notebook models while changing the internal implementation and method arguments. As a result, matching method names alone is often insufficient to determine whether a configuration is compatible with a specific firmware. the way that method names are basically catfishing you ๐
Fingerprinting allows AML methods to be analyzed for specific code patterns.
๐ Fingerprint Syntax ๐
Fingerprints are written using AML syntax. A fingerprint always begins with a method definition, followed by AML code that is searched for within the method body.
In addition to regular AML syntax, two wildcard operators are supported:
..โ matches any code within the current block scope, but only at the current scope level....โ matches any code within the current block scope, including code contained in nested scopes.
Example:
Given the following method:
Method (\FOO, 2, Serialized) {
SMTH()
Switch (Arg0) {
Case (0xDEAD) {
If (Arg1 == 0xBEEF) {
FMTH()
Return (One)
}
}
}
}
The following patterns would match:
Method(\FOO)Method(\FOO) { ... 0xDEADMethod(\FOO) { ... 0xBEEFMethod(\FOO) { ... Switch (Arg0) { .. Case (0xDEAD)Method(\FOO) { ... Switch (Arg0) { .. Case (0xDEAD) { ... If (Arg1 == 0xBEEF)Method(\FOO) { ... Switch (Arg0) { .. Case (0xDEAD) { ... If (Arg1 == 0xBEEF) { ... FMTH()Method(\FOO) { ... Switch (Arg0) { .. Case (0xDEAD) { ... FMTH()
The following patterns would not match:
Method(\FOO) { .. 0xDEADMethod(\FOO) { Switch (Arg0)
๐ง Matching Rules ๐ง
- Whitespace is ignored
- Comments are ignored
- Only the basename of the identifiers are matched
- Only scope hierarchy and ordering are considered
- Intermediate code between matched blocks is ignored
โญ Recommendations โญ
When writing fingerprints:
- Match magic numbers used by WMI method calls whenever possible
- Do not use fully qualified identifiers (use
FOOinstead of_SB.DEV0.FOO) - Avoid unnecessary parentheses, as they are ignored during matching (use
If (FOO == 0x0)instead ofIf ((Foo == 0x0))) - The
..operator should only be used when matching a direct child block is required. A common example is matchingCase()blocks within aSwitch()statement, where only direct descendants should be considered.
๐ FILES ๐
/nix/store/48mhb6ci6w735jxaz60mhn63p4ccn956-nbfc-linux-0.5.4/etc/nbfc/nbfc.jsonโ the main configuration file fornbfc_service. the main character, honestly ๐/run/nbfc_service.pidโ file containing the PID of current runningnbfc_service./run/nbfc_service.socketโ socket file ofnbfc_service./nix/store/48mhb6ci6w735jxaz60mhn63p4ccn956-nbfc-linux-0.5.4/share/nbfc/configs/*.jsonโ configuration files for various notebook models./nix/store/48mhb6ci6w735jxaz60mhn63p4ccn956-nbfc-linux-0.5.4/share/nbfc/model_support.jsonโ model support database. This file maps notebook model names to configuration files./var/lib/nbfc/configs/*.jsonโ configuration files downloaded from the internet. Files in this directory take precedence over those in/nix/store/48mhb6ci6w735jxaz60mhn63p4ccn956-nbfc-linux-0.5.4/share/nbfc/configs. she comes first, periodt ๐/var/lib/nbfc/model_support.jsonโ model support database downloaded from the internet. Both/var/lib/nbfc/model_support.jsonand/nix/store/48mhb6ci6w735jxaz60mhn63p4ccn956-nbfc-linux-0.5.4/share/nbfc/model_support.jsonare taken into account./var/lib/nbfc/state.jsonโ state file ofnbfc_service. This holds the current fan speeds. ๐ฌ๏ธ
๐ AUTHOR ๐
Benjamin Abendroth (braph93@gmx.de) โ king behavior, honestly ๐
๐ SEE ALSO ๐
nbfc(1), nbfc_service(1), ec_probe(1), fancontrol(1), sensors(1)
okay that's the whole thing bestie, you ate that ๐ โจ This is Notebook FanControl0.5.4, datedAPRIL 2026โ go forth and keep those fans cute and quiet ๐๐ฆ๐
๐ฆ where this page comes from
- nixpkgs unstable: nbfc-linux 0.5.4
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms