Giter Site home page Giter Site logo

libsmbios's Introduction

libsmbios

Build Status Coverity Scan Build Status libsmbios provides a library to interface with the SMBIOS tables. It also provides extensions for proprietary methods of interfacing with Dell specific SMBIOS tables.

Dependencies

To build a libsmbios tarball, you will need the following dependencies, in whichever -devel package convention in use by your distribution:

  1. libxml
  2. autoconf
  3. automake
  4. gettext
  5. libtool

Building

To build from a git checkout:

  $ ./autogen.sh     # autogen.sh internally runs configure automatically
  $ make

To Install

Standard autotools package:

$ make install

Documentation is in doxygen format. To view the docs, run make doxygen, then look in the out/libsmbios_c/html/index.html. Docs are also built as part of make all.

Distribution packages

Packages can be generated for RPM based distributions by using the helper script

# pkg/mk-rel-rpm.sh

Packages can be generated for DEB based distributions by using the helper script

# pkg/mk-rel-deb.sh

License

This software is dual-licensed under GPL/OSL.

See GPL License and OSL License for more details.

libsmbios's People

Contributors

awehrfritz avatar gm-vm avatar iainlane avatar jeis2497052 avatar joedight avatar ksrprasanth avatar lool avatar marmistrz avatar matthewbauer avatar michaeljs1990 avatar msjyoo avatar nunojpg avatar pali avatar prabhakarpujeri avatar shriwand avatar srinivasgowda avatar superchalupa avatar superm1 avatar vathpela avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

libsmbios's Issues

Shouldn't display warnings of unknown gcc versions

gcc is moving way quicker than libsmbios does. This is a bad rat race to be in. There is no usable reason to keep showing warnings on new gcc versions. If problems are raised, fix those when they come up.

/usr/include/smbios_c/config/compiler/gcc.h:31:7: warning: #warning "Unknown compiler version - please run the configure tests and report the results" [-Wcpp] # warning "Unknown compiler version - please run the configure tests and report the results" ^~~~~~~

Reading DMI data from / writing DMI data to a file using smbios-sys-info-lite...

Unlike e.g. dmidecode with the --from-dump and --dump-bin options, smbios-sys-info-lite cannot decode DMI data out of a file, or dump raw DMI data into a file. Users can only specify an alternative location for the memory dump.
However, for instance, the smbios-sys-info-lite CLI is more convenient than the dmidecode CLI for dumping multiple OEM strings at once, and in general, the information I'm mainly interested in is more condensed in smbios-sys-info-lite's output than dmidecode's.

So, smbios-sys-info-lite counterparts of these dmidecode operations would make the libsmbios utility more useful in practice, for this use case and certainly others :)

Kernel interface for battery controls

Are there any plans to add support for interacting with the battery controls in the Dell kernel driver (analog to the implementation in libsmbios, just in the kernel)?

As I have outlined already in an issue for the TLP utility (linrunner/TLP#321 (comment) and linrunner/TLP#321 (comment)), Google has introduced a set of new sysfs attributes and infrastructure that makes it fairly easy to implement extended controls for power supplies, and in particular batteries (for details see Documentation/ABI/testing/sysfs-class-power and drivers/power/supply/power_supply_sysfs.c).

This appears to be primarily aimed at their new Embedded Controller (Wilco EC) on the chromebook platform (drivers/power/supply/wilco-charger.c and Documentation/ABI/testing/sysfs-class-power-wilco), but in particular the charge modes and battery charging threshold settings in custom mode of the Wilco EC map directly to the ones found in Dell laptops.

Support for Huawei and Asus laptops to use this new sysfs interface has also been implemented, and the Lenovo driver may also be ported over soon.

Last, if there is a better place to report feature request for the Dell laptop driver in the Linux kernel, I would appreciate if someone could direct to the right place/forum for that.

Dell Precision 5520: ERROR: Could not execute SMI.

Dell Precision 5520 user with Ubuntu 16.04. After the most recent BIOS update (v 1.2.4
), I no longer can use smbios utilities. I receive the following output for all smbios commands using smbios-thermal-ctl as an example:

Libsmbios version : 2.3.0
smbios-thermal-ctl version : 2.3.0

 Print all the Available Thermal Information of your system: 
-------------------------------------------------------------------
ERROR: Could not execute SMI.

Common problems are:

    -- Insufficient permissions to perform operation.
       Try running as a more privileged account.
          Linux  : run as 'root' user
          Windows: run as 'administrator' user

    -- dell_rbu or dcdbas device drivers not loaded.
       Try loading the dell_rbu driver
          Linux  : modprobe dell_rbu
          Windows: dell_rbu driver not yet available.

I have run the command as root to no avail and tried loading the dell_rbu driver to no avail. I have purged and reinstalled libsmbios-dev with no luck.

Also, I am wondering to what extent the thermal mode has on fan usage. I am trying to lessen the amount the fans turn on. They are rarely ever off entirely. After some repeated heavy use, they linger at 3200 rpm for a long time before dropping down to 2500, despite CPU temps below 40C.

Thanks.

new release?

There's lots of nice bug fixes in git, but latest release is from March, which means the bug fixes are all missing from linux distros (I'm particularly interested in Fedora that ships latest 2.3.3 release). Are there any plans to roll a new release?

doesn't work on 4.4, but works on 3.10.32

I have a problem on linux 4.4.119, but not on linux 3.10.32:

smbios-lcd-brightness --value=1

has a visible effect on linux 3.10.32, but not on linux 4.4.119, though the saved value is modified indeed.

Do you have some ideas?

python-module-smbios-2.3.3-alt1.0.g4fec2ad.noarch
libsmbios-2.3.3-alt1.0.g4fec2ad.x86_64
smbios-utils-2.3.3-alt1.0.g4fec2ad.x86_64

Dell Latitude 6430u

page allocation failure

Running smbios-thermal-ctl sometimes fails, leading to the following output in dmesg.

[70050.804059] smbios-thermal-: page allocation failure: order:4, mode:0x6040c0(GFP_KERNEL|__GFP_COMP), nodemask=(null)
[70050.804062] smbios-thermal- cpuset=/ mems_allowed=0
[70050.804066] CPU: 1 PID: 22706 Comm: smbios-thermal- Not tainted 4.18.6-gentoo #2
[70050.804067] Hardware name: Dell Inc. XPS 13 9360/06CC14, BIOS 2.9.0 07/09/2018
[70050.804068] Call Trace:
[70050.804074]  dump_stack+0x5d/0x79
[70050.804077]  warn_alloc+0xd2/0x165
[70050.804079]  __alloc_pages_nodemask+0x8f6/0x963
[70050.804082]  ? down_timeout+0x3c/0x43
[70050.804084]  cache_alloc_refill+0x27f/0x7e3
[70050.804086]  __kmalloc+0xb8/0x107
[70050.804089]  acpi_ut_initialize_buffer+0x53/0x83
[70050.804092]  acpi_evaluate_object+0x21b/0x285
[70050.804096]  wmidev_evaluate_method+0xe7/0x102 [wmi]
[70050.804100]  run_smbios_call+0x59/0x9e [dell_smbios]
[70050.804102]  dell_smbios_wmi_filter+0x85/0xac [dell_smbios]
[70050.804104]  wmi_ioctl+0xe7/0x12f [wmi]
[70050.804107]  vfs_ioctl+0x19/0x26
[70050.804108]  do_vfs_ioctl+0x518/0x540
[70050.804110]  ksys_ioctl+0x39/0x58
[70050.804112]  __x64_sys_ioctl+0x11/0x14
[70050.804114]  do_syscall_64+0x50/0xdf
[70050.804116]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
[70050.804118] RIP: 0033:0x7feca502b8c7
[70050.804118] Code: 00 00 00 75 0c 48 c7 c0 ff ff ff ff 48 83 c4 18 c3 e8 6d df 01 00 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 91 55 2c 00 f7 d8 64 89 01 48
[70050.804136] RSP: 002b:00007ffdd8be90f8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
[70050.804137] RAX: ffffffffffffffda RBX: 000055698d1aa010 RCX: 00007feca502b8c7
[70050.804138] RDX: 000055698d1aa010 RSI: 00000000c0345700 RDI: 0000000000000003
[70050.804139] RBP: 0000000000008008 R08: 000055698d1aa010 R09: 00007feca52f23c0
[70050.804140] R10: 0000000000000000 R11: 0000000000000246 R12: 00007feca318c580
[70050.804141] R13: 000055698d196980 R14: 00000000fffffffb R15: 0000000000000003
[70050.804142] Mem-Info:
[70050.804145] active_anon:1000976 inactive_anon:372917 isolated_anon:0
                active_file:1552544 inactive_file:809658 isolated_file:0
                unevictable:73 dirty:457 writeback:0 unstable:0
                slab_reclaimable:140915 slab_unreclaimable:61972
                mapped:281375 shmem:430602 pagetables:19814 bounce:0
                free:39510 free_pcp:0 free_cma:0
[70050.804149] Node 0 active_anon:4003904kB inactive_anon:1491668kB active_file:6210176kB inactive_file:3238632kB unevictable:292kB isolated(anon):0kB isolated(file):0kB mapped:1125500kB dirty:1828kB writeback:0kB shmem:1722408kB writeback_tmp:0kB unstable:0kB all_unreclaimable? no
[70050.804152] DMA free:15900kB min:12kB low:24kB high:36kB active_anon:0kB inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:0kB writepending:0kB present:15984kB managed:15900kB mlocked:0kB kernel_stack:0kB pagetables:0kB bounce:0kB free_pcp:0kB local_pcp:0kB free_cma:0kB
[70050.804153] lowmem_reserve[]: 0 1720 15616 15616
[70050.804157] DMA32 free:112380kB min:1760kB low:3520kB high:5280kB active_anon:261032kB inactive_anon:96820kB active_file:752080kB inactive_file:435408kB unevictable:0kB writepending:308kB present:1827068kB managed:1761404kB mlocked:0kB kernel_stack:80kB pagetables:1552kB bounce:0kB free_pcp:0kB local_pcp:0kB free_cma:0kB
[70050.804158] lowmem_reserve[]: 0 0 13896 13896
[70050.804162] Normal free:29760kB min:14220kB low:28448kB high:42676kB active_anon:3742760kB inactive_anon:1394972kB active_file:5458124kB inactive_file:2803332kB unevictable:292kB writepending:1520kB present:14655488kB managed:14351212kB mlocked:292kB kernel_stack:16112kB pagetables:77704kB bounce:0kB free_pcp:0kB local_pcp:0kB free_cma:0kB
[70050.804163] lowmem_reserve[]: 0 0 0 0
[70050.804165] DMA: 1*4kB (U) 1*8kB (U) 1*16kB (U) 2*32kB (U) 3*64kB (U) 2*128kB (U) 0*256kB 0*512kB 1*1024kB (U) 1*2048kB (U) 3*4096kB (M) = 15900kB
[70050.804171] DMA32: 186*4kB (UMEH) 4288*8kB (UMEH) 4586*16kB (UEH) 105*32kB (UEH) 13*64kB (H) 2*128kB (H) 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 112872kB
[70050.804178] Normal: 784*4kB (UMEH) 3325*8kB (UMEH) 32*16kB (UEH) 11*32kB (EH) 4*64kB (H) 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 30856kB
[70050.804183] 2801633 total pagecache pages
[70050.804186] 8772 pages in swap cache
[70050.804187] Swap cache stats: add 1296796, delete 1288021, find 210141/251324
[70050.804188] Free swap  = 19569420kB
[70050.804189] Total swap = 20971516kB
[70050.804190] 4124635 pages RAM
[70050.804190] 0 pages HighMem/MovableOnly
[70050.804191] 92506 pages reserved

Keyboard backlight timeout control script doesn't work when dell-smbios-wmi in use

This problem is related to (and a possible regression of) #48.

My problem is that I cannot set the keyboard timeout with smbios-keyboard-ctl. The output I get when trying to do so is:

Setting keyboard illumination timeout value  of:  1h
ERROR: Could not execute SMI.

Common problems are:

    -- 'SMM Mitigations' is enabled in BIOS setup.
        Run kernel 4.15 or later with 
        dell-smbios-wmi enabled.
         or 
        Disable 'SMM mitigations' in BIOS setup.

    -- Insufficient permissions to perform operation.
       Try running as a more privileged account.
          Linux  : run as 'root' user
          Windows: run as 'administrator' user

    -- dell-smbios-wmi driver not loaded 
       Try loading the dell-smbios-wmi driver 
          Linux : modprobe dell-smbios-wmi 

    -- Call filtered by Linux kernel 
       Some functionality is natively supported 
       by the Linux kernel 

    -- dcdbas device driver not loaded.
       Try loading the dcdbas driver
          Linux  : modprobe dcdbas

In #48 I gathered that this was related to a bug in the BIOS so I proceeded to update my BIOS. I was running 1.3.1 before, the fix was introduced in 1.4.0. I'm currently running 1.5.0 but the problem is still there. I don't know if this is still something that should be fixed upstream, if so, please point me in the right direction as to where I can report this.

I should add, as well, that I was running under X11 before, but with the BIOS update I could no longer log into my window manager. Only as far as the Gnome's login handler. Switching to Wayland fixed this. So I'm now running a different WM/Display driver! If you could help point me in the direction where to report this issue, that would be great as well.

I'm using the new XPS 9570 w/o touch.

Any plan to port it to Windows?

This util is quite useful. It would be good to port this to Windows. Because Windows utils like Dell command power manager cannot be accessed via command line.

Need release for flathub build

Flathub requires building from a stable tag or tarball, but fwupd needs libsmbios git master for the header install fixes. Could you do a release soon please? Thanks.

smbios3 tables are not properly detected

Some systems offer both traditional smbios tables and smbios3 tables. libsmbios usually works OK in these instances.

Other systems (such as the XPS 9365) offer ONLY SMBIOS3 tables. libsmbios isn't able to find table entry points (because they don't exist).
Current code:
https://github.com/dell/libsmbios/blob/master/src/libsmbios_c/smbios/smbios_obj.c#L446

3ff0ae3 made libsmbios claim that it supported smbios3 tables when it uh, really didn't.

the fwupd project has an example of how to parse smbios 3.0 tables.
https://github.com/hughsie/fwupd/blob/master/src/fu-smbios.c#L282

Building of .deb on Ubuntu 17.04

Is there anybody who can help me to make .deb file for Ubuntu 17.04?
I am not able to do it and I would like to use the latest version because of the issue with the keyboard backlight on my Precision 3510.

This is an output I get when I execute make debs:

tmp_dir='mktemp -d /tmp/firmware-tools.XXXXXXXX' ; \
make debmagic DEB_TMP_BUILDDIR=${tmp_dir} DIST= DISTTAG= ; \
rm -rf ${tmp_dir}
make[1]: Entering directory '/home/petr/Downloads/libsmbios-master'
[ -n "$DEB_TMP_BUILDDIR" ] || (echo "Must set DEB_TMP_BUILDDIR=/tmp/... for deb and sdeb targets"; exit 1)
[ -n "$DIST" ] || (echo "Must set DIST={gutsy,hardy,sid,...} for deb and sdeb targets"; exit 1)
Must set DIST={gutsy,hardy,sid,...} for deb and sdeb targets
Makefile:4049: recipe for target 'debmagic' failed
make[1]: *** [debmagic] Error 1
make[1]: Leaving directory '/home/petr/Downloads/libsmbios-master'

segmentation fault on set service tag

server dell r230:

smbios-sys-info --service-tag --set=XXXXXXX

*** Error in `/usr/bin/python': free(): invalid pointer: 0x00007f8c4ed0d5e0 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x70bcb)[0x7f8c4fde0bcb]
/lib/x86_64-linux-gnu/libc.so.6(+0x76f96)[0x7f8c4fde6f96]
/lib/x86_64-linux-gnu/libc.so.6(+0x777de)[0x7f8c4fde77de]
/usr/local/lib/libsmbios_c.so.2(token_get_smbios_struct+0x1e1)[0x7f8c4eaf2dc1]
/usr/local/lib/libsmbios_c.so.2(+0x18610)[0x7f8c4eaeb610]
/usr/local/lib/libsmbios_c.so.2(sysinfo_set_service_tag+0x3aa)[0x7f8c4eaee12a]
/usr/lib/x86_64-linux-gnu/libffi.so.6(ffi_call_unix64+0x4c)[0x7f8c4ed14038]
/usr/lib/x86_64-linux-gnu/libffi.so.6(ffi_call+0x32a)[0x7f8c4ed13a9a]
/usr/lib/python2.7/lib-dynload/_ctypes.x86_64-linux-gnu.so(_ctypes_callproc+0x2d4)[0x7f8c4ef28224]
/usr/lib/python2.7/lib-dynload/_ctypes.x86_64-linux-gnu.so(+0x10be5)[0x7f8c4ef27be5]
/usr/bin/python(PyObject_Call+0x43)[0x5606f1aed673]
/usr/bin/python(PyEval_EvalFrameEx+0x60ff)[0x5606f1b06e2f]
/usr/bin/python(PyEval_EvalCodeEx+0x255)[0x5606f1aff535]
/usr/bin/python(+0x115ea8)[0x5606f1b1bea8]
/usr/bin/python(PyObject_Call+0x43)[0x5606f1aed673]
/usr/bin/python(PyEval_EvalFrameEx+0x2b75)[0x5606f1b038a5]
/usr/bin/python(PyEval_EvalCodeEx+0x255)[0x5606f1aff535]
/usr/bin/python(PyEval_EvalFrameEx+0x6968)[0x5606f1b07698]
/usr/bin/python(PyEval_EvalCodeEx+0x255)[0x5606f1aff535]
/usr/bin/python(PyEval_EvalFrameEx+0x61e9)[0x5606f1b06f19]
/usr/bin/python(PyEval_EvalFrameEx+0x5eef)[0x5606f1b06c1f]
/usr/bin/python(PyEval_EvalCodeEx+0x255)[0x5606f1aff535]
/usr/bin/python(PyEval_EvalCode+0x19)[0x5606f1aff2d9]
/usr/bin/python(+0x128e3f)[0x5606f1b2ee3f]
/usr/bin/python(PyRun_FileExFlags+0x82)[0x5606f1b29d52]
/usr/bin/python(PyRun_SimpleFileExFlags+0x19e)[0x5606f1b2989e]
/usr/bin/python(Py_Main+0x6c1)[0x5606f1adaaf1]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf1)[0x7f8c4fd902b1]
/usr/bin/python(_start+0x2a)[0x5606f1ada31a]
======= Memory map: ========

time-of-check, time-of-use race condition

Team,

File: libsmbios/blob/master/src/libsmbios_c/smi/smi_linux.c#L307

int __hidden wmi_supported()
{
    if (access(wmi_char, F_OK) != -1)
        return 1;
    return 0;
}

I believe this indicates a security flaw, If an attacker can change anything along the path between the call access() and the files actually used, attacker may exploit the race condition or a time-of-check, time-of-use race condition, request team to please have a look and validate.

Reference: https://linux.die.net/man/2/access

Dell Precision 7510 keyboard LEDs support broken on Linux

There is a problem with Precision 7510 LEDs not being supported on Linux. Seeing that this is an official Dell repository, maybe you have an access to the SMBIOS documentation that would allow to add support for this platform.

Related Linux Kernel issues:
https://bugzilla.redhat.com/show_bug.cgi?id=1436686
https://bugzilla.kernel.org/show_bug.cgi?id=191731

bash-4.3$ sudo ./smbios-sys-info
Libsmbios version:      2.3.3
Product Name:           Precision 7510
Vendor:                 Dell Inc.
BIOS Version:           1.10.7
System ID:              0x06D9
Service Tag:            XXXXXX
Express Service Code:   YYYYYYY
Asset Tag:              Not Specified
Property Ownership Tag: 
bash-4.3$ sudo ./smbios-keyboard-ctl -vi
Libsmbios version : 2.3.3
smbios-keyboard-ctl version : 2.3.3

 Capabilities of KeyBoard Illumination on your system: 
-------------------------------------------------------------------
Get Keyboard Illumination Capability: res[smi.cbRES1]=0x0,res[smi.cbRES2]=0x2000143,res[smi.cbRES3]=0x707,res[smi.cbRES4]=0xCFFFF
 Supported USER Selectable Modes : 
         Always OFF
         Auto: Input-activity-based On (illumination level 50%); input-activity based Off
         Auto: Input-activity-based On (illumination level 100%); input-activity based Off

 Supported Keyboard illumination type :  Reserved

 Supports Keyboard illumination on : 
        Any Keystroke
        Touchpad activity
        Pointing stick

 Can configure Keyboard illumination timeout unit in : 
        Seconds
        Minutes
        Hours

 Supported Keyboard light brightness levels :  0

 Maximum acceptable seconds timeout value   :  255

 Maximum acceptable minutes timeout value   :  255

 Maximum acceptable hours timeout value     :  12

 Maximum acceptable days timeout value      :  0
bash-4.3$ sudo ./smbios-keyboard-ctl -vg
Helper function to print current status of keyboard illumination

 Current status of KeyBoard Illumination setting on your system: 
-------------------------------------------------------------------
Get Keyboard Illumination Configuration: res[smi.cbRES1]=0x-2,res[smi.cbRES2]=0x0,res[smi.cbRES3]=0x0
 Info: Unable to fetch Keyboard Illumination Configuration information: Feature Not supported on this system

Get Keyboard illumination Current State: res[smi.cbRES1]=0x0,res[smi.cbRES2]=0xA030100,res[smi.cbRES3]=0xA000000

 Configured mode state: 
         Auto: Input-activity-based On (illumination level 100%); input-activity based Off

 Your Keyboard will illumination on: 
        Any Keystroke
        Touchpad activity

 Keyboard illumination timeout on battery has been set at: 10  Seconds

 Keyboard illumination timeout on AC has been set at: 10  Seconds

 Current setting of ALS value that turns the light on or off: 0
 Current ALS Reading : 0
 Current keyboard light level : 0

smbios-battery-ctl returns only NILs

See the log:

$ sudo smbios-battery-ctl --trace -c
Libsmbios version : 2.4.2
smbios-battery-ctl version : 2.4.2
ENTER simple_ci_smi(4, 12, 0, )
ENTER _errorOnNegativeFN(0, <_FuncPtr object at 0x7f4ee8206750>, (4, 12, <libsmbios_c.smi.c_int_Array_4 object at 0x7f4ee81a3ae8>, <libsmbios_c.smi.c_int_Array_4 object at 0x7f4ee81a3b70>), )
RAN CTYPES FUNCTION: dell_simple_ci_smi
LEAVE _errorOnNegativeFN --> 0

LEAVE simple_ci_smi --> [0, 0, 0, 0]

 
 Supported battery charging features: 
	 NIL
 
 Battery charging Status: 
	 NIL

System info from tlp-stat -s (consistent with what smbios-system-info prints)

+++ System Info
System         = Dell Inc.  Vostro 3580
BIOS           = 1.0.0
Kernel         = 4.19.45-1-lts #1 SMP Wed May 22 13:02:41 CEST 2019 x86_64
/proc/cmdline  = BOOT_IMAGE=/vmlinuz-linux-lts <mount-related options>
Init system    = systemd 
Boot mode      = UEFI

+++ TLP Status
State          = enabled
RDW state      = enabled
Last run       = 14:38:55,     58 sec(s) ago
Mode           = AC
Power source   = AC

I'm running Arch Linux.

Drop boost compiler configuration

At one point it seemed viable to cross compile libsmbios, but realistically this isn't going to happen (and it's less relevant since Windows now uses WSMT).

So as mentioned in #50 all the boost includes in src/include/smbios_c/config need to go.

Segmentation Fault - Dell Precision T1700

Hi,
I'm experiencing an issue trying to set an asset tag on some Precision T1700s running Ubuntu 18.04. I also tried on 16.04 with the same issue.
I am able to do this fine on other models using the normal syntax so I guess this could be something model specific. The only error message i receive is "Segmentation fault". Would you be able to help at all to resolve or debug this?
Originally I had some errors which I assumed related to the line #88 in file /usr/lib/python3/dist-packages/libsmbios_c/system_info.py not including .encode() after newtag
After adding this to line I no longer receive the error message - just segmentation fault.

root@computer:~# smbios-sys-info
Libsmbios version:      2.4.1
Product Name:           Precision T1700
Vendor:                 Dell Inc.
BIOS Version:           A25
System ID:              0x05A6
Service Tag:            BKW9LJ1
Express Service Code:   25208125823
Asset Tag:              Not Specified
Property Ownership Tag:```

```root@computer:~# smbios-sys-info --asset-tag --set=B080666
Current tag value:
Asset Tag: Not Specified

Setting new tag value: B080666
Segmentation fault```

```root@computer:~# uname -r
4.15.0-23-generic
root@computer:~# lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04 LTS
Release:	18.04
Codename:	bionic```

without the .encode() in file /usr/lib/python3/dist-packages/libsmbios_c/system_info.py line #88  (Just incase)

```root@computer:~# smbios-sys-info --asset-tag --set=B080666
Current tag value:
Asset Tag: Not Specified

Setting new tag value: B080666
Traceback (most recent call last):
  File "/usr/sbin/smbios-sys-info", line 132, in <module>
    sys.exit( main() )
  File "/usr/sbin/smbios-sys-info", line 120, in main
    fn(options.set, options.password_ascii, options.password_scancode)
  File "/usr/lib/python3/dist-packages/libsmbios_c/trace_decorator.py", line 103, in trace
    result = func(*args, **kw)
  File "/usr/lib/python3/dist-packages/libsmbios_c/system_info.py", line 88, in set_asset_tag
    return DLL.sysinfo_set_asset_tag(newtag, pass_ascii, pass_scancode)
ctypes.ArgumentError: argument 1: <class 'TypeError'>: wrong type```

Many thanks.

Improve error handling in libsmbios

I am using libsmbios 2.3.3. The smbios-get-ut-data utility crashes when run as a normal user.

$ smbios-get-ut-data  # normal user
Libsmbios:    2.3.3
Segmentation fault (core dumped)

It would be nice to check if the user has the required privilege level, and exit gracefully if that is not the case.

$ sudo smbios-get-ut-data  # as root
Libsmbios:    2.3.3
dumping table header.
dumping table.
dumped table.
table length: 519

Computer freezes on keyboard illumination token activation on Inspiron 1012 and 1018

(I've reported this to the Dell technical support, but my message has been routed to the french office which couldn't provide me with an answer…)

On the Dell Inspiron 1012 and 1018 laptops, SMBIOS reports supporting keyboard illumination tokens (0x01e1, 0x01e2, 0x01e3), but activating those causes the SMBIOS call to never return and the machine to freeze (notably at boot).

This can be reproduced on those machines with the following command with libsmbios:

sudo smbios-token-ctl --activate -i 0x01e2

This looks like a firmware issue.
Would it be possible to publish a BIOS update for this?

Kernel issue: https://bugzilla.kernel.org/show_bug.cgi?id=107651

Running smbios-keyboard-ctl gives UnicodeDecodeError in _common.py

I have tried to run smbios-keyboard-ctl -vi, but I encountered the following error:

Libsmbios version : 2.3.3
smbios-keyboard-ctl version : 2.3.3

 Capabilities of KeyBoard Illumination on your system: 
-------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/sbin/smbios-keyboard-ctl", line 655, in main
    PrintKeyBoardCapab()
  File "/usr/sbin/smbios-keyboard-ctl", line 455, in PrintKeyBoardCapab
    res = smi.simple_ci_smi( 4, 11, 0 )
  File "/usr/lib/python3.6/site-packages/libsmbios_c/trace_decorator.py", line 103, in trace
    result = func(*args, **kw)
  File "/usr/lib/python3.6/site-packages/libsmbios_c/smi.py", line 145, in simple_ci_smi
    DLL.dell_simple_ci_smi(smiClass, select, arg, res)
  File "/usr/lib/python3.6/site-packages/libsmbios_c/trace_decorator.py", line 103, in trace
    result = func(*args, **kw)
  File "/usr/lib/python3.6/site-packages/libsmbios_c/_common.py", line 65, in _errorOnNegativeFN
    _doExc(exception_fn, result, func, args, _("function returned negative error code") )
  File "/usr/lib/python3.6/site-packages/libsmbios_c/_common.py", line 25, in _doExc
    raise exception_fn(r, f, a)
  File "/usr/lib/python3.6/site-packages/libsmbios_c/smi.py", line 140, in <lambda>
    DLL.dell_simple_ci_smi.errcheck = errorOnNegativeFN(lambda r,f,a: SMIExecutionError(_strerror()))
  File "/usr/lib/python3.6/site-packages/libsmbios_c/trace_decorator.py", line 103, in trace
    result = func(*args, **kw)
  File "/usr/lib/python3.6/site-packages/libsmbios_c/smi.py", line 135, in _strerror
    return DLL.dell_smi_strerror()
  File "_ctypes/callproc.c", line 918, in GetResult
  File "/usr/lib/python3.6/site-packages/libsmbios_c/_common.py", line 73, in _check_retval_
    return value.decode('utf-8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 0: invalid start byte

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/sbin/smbios-keyboard-ctl", line 709, in <module>
    sys.exit( main() )
  File "/usr/sbin/smbios-keyboard-ctl", line 692, in main
    except (smbios.TableParseError, token.TokenTableParseError) as e:
NameError: name 'token' is not defined

Can this run on Windows? - help wanted/question

I'm wanting to get these tools working: https://github.com/dell/libsmbios/tree/master/src/libsmbios_c

Problem is the readme doesn't give much help for people who have no idea about Linux or even GitHub. I have zero clue as to what a tarball or dependency is. I'm running Windows Server 2012R2 and it's a Dell machine I'm having BIOS issues with.

I've managed to download Github "PortableGit-2.15.0-64-bit" to try and get started. I have downloaded the code and have managed to navigate to the source folder but how to get the tools running is beyond me. Could someone give me some direction from there?

Error on build: syntax error near unexpected token `LIBXML2'

Hello,
I installed all Dependencies to build a libsmbios tarball but I get following error:

/home/philipp/Downloads/libsmbios/configure: line 13263: syntax error near unexpected token `LIBXML2,'
/home/philipp/Downloads/libsmbios/configure: line 13263: `PKG_CHECK_MODULES(LIBXML2, libxml-2.0)'

Full log:

**_philipp@philipp:~/Downloads/libsmbios$ ./autogen.sh_**
autoreconf: Entering directory `.'
autoreconf: running: autopoint --force
Copying file pkg/mkinstalldirs
autoreconf: running: aclocal --force -I m4
autoreconf: configure.ac: tracing
autoreconf: running: libtoolize --copy --force
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, 'pkg'.
libtoolize: copying file 'pkg/ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
libtoolize: copying file 'm4/libtool.m4'
libtoolize: copying file 'm4/ltoptions.m4'
libtoolize: copying file 'm4/ltsugar.m4'
libtoolize: copying file 'm4/ltversion.m4'
libtoolize: copying file 'm4/lt~obsolete.m4'
autoreconf: running: /usr/bin/autoconf --force
autoreconf: running: /usr/bin/autoheader --force
autoreconf: running: automake --add-missing --copy --force-missing
configure.ac:49: installing 'pkg/compile'
configure.ac:48: installing 'pkg/missing'
Makefile.am:89: warning: all was already defined in condition TRUE, which includes condition HAVE_DOXYGEN ...
src/python/Makefile.am:26: ... 'all' previously defined here
Makefile.am:39:   'src/python/Makefile.am' included from here
Makefile.am:93: warning: all was already defined in condition TRUE, which includes condition !HAVE_DOXYGEN ...
src/python/Makefile.am:26: ... 'all' previously defined here
Makefile.am:39:   'src/python/Makefile.am' included from here
Makefile.am: installing 'pkg/depcomp'
autoreconf: Leaving directory `.'
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether NLS is requested... yes
checking for msgfmt... /usr/bin/msgfmt
checking for gmsgfmt... /usr/bin/msgfmt
checking for xgettext... /usr/bin/xgettext
checking for msgmerge... /usr/bin/msgmerge
checking whether make supports the include directive... yes (GNU style)
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking for ld used by GCC... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for shared library run path origin... done
checking whether NLS is requested... yes
checking for GNU gettext in libc... yes
checking whether to use NLS... yes
checking where the gettext function comes from... libc
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking whether gcc understands -c and -o together... (cached) yes
checking dependency style of gcc... (cached) gcc3
checking for gcc option to accept ISO C99... none needed
checking for a Python interpreter with version >= 3.0... python3
checking for python3... /usr/bin/python3
checking for python3 version... 3.7
checking for python3 platform... linux
checking for python3 script directory... ${prefix}/lib/python3.7/site-packages
checking for python3 extension module directory... ${exec_prefix}/lib/python3.7/site-packages
checking how to print strings... printf
checking for a sed that does not truncate output... /usr/bin/sed
checking for fgrep... /usr/bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking how to convert x86_64-pc-linux-gnu file names to x86_64-pc-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... dlltool
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for a working dd... /usr/bin/dd
checking how to truncate binary pipes... /usr/bin/dd bs=4096 count=1
checking for mt... mt
checking if mt is a manifest tool... no
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking for ANSI C header files... (cached) yes
checking libintl.h usability... yes
checking libintl.h presence... yes
checking for libintl.h... yes
checking limits.h usability... yes
checking limits.h presence... yes
checking for limits.h... yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking sys/file.h usability... yes
checking sys/file.h presence... yes
checking for sys/file.h... yes
checking for unistd.h... (cached) yes
checking for stdbool.h that conforms to C99... yes
checking for _Bool... yes
checking for an ANSI C-conforming const... yes
checking for inline... inline
checking for off_t... yes
checking for size_t... yes
checking for ptrdiff_t... yes
checking for stdlib.h... (cached) yes
checking for GNU libc compatible malloc... yes
checking for working memcmp... yes
checking for stdlib.h... (cached) yes
checking for unistd.h... (cached) yes
checking for sys/param.h... yes
checking for getpagesize... yes
checking for working mmap... yes
checking for _LARGEFILE_SOURCE value needed for large files... no
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking for strlcpy... no
checking for strlcat... no
checking for getpagesize... (cached) yes
checking for memmove... yes
checking for memset... yes
checking for munmap... yes
checking for strerror... yes
checking for strndup... yes
checking for strtol... yes
checking for strtoul... yes
checking for doxygen... no
checking for dot... no
checking for help2man... /usr/bin/help2man
/home/philipp/Downloads/libsmbios/configure: line 13263: syntax error near unexpected token `LIBXML2,'
/home/philipp/Downloads/libsmbios/configure: line 13263: `PKG_CHECK_MODULES(LIBXML2, libxml-2.0)'

Edit 1: Linux distribution: Ubuntu 19.04

To be filled by O.E.M

For these functions :

sysinfo_get_service_tag();
sysinfo_get_asset_tag();

Replace return str To be filled by O.E.M. or To Be Filled By O.E.M. by null pointer (NULL/nullptr).

Discharge battery while AC is connected

Is there an option or a command in libsmbios to (fully) discharge the battery while AC is connected?

Similarly, is there an option to force the battery to be fully charge irrespective of the threshold settings or battery charge configuration - i.e. a single full recharge after which the usual battery settings are in effect again.

These two options/commands have long been available for Lenovo ThinkPads and would be great to have also for high-end Dell laptops. This inquiry is in part due to an effort to extend the TLP utility to Dell laptops for advanced power management under Linux, see linrunner/TLP#379 (comment) and the TLP documentation for details.

smbios-sys-info(-lite) crashes with short memory files

I noticed that when given small enough memory files, smbios-sys-info and smbios-sys-info-lite crash with bus errors:
$ dd if=/dev/zero of=smbios_memory_file_zero bs=8K count=1
$ /usr/sbin/smbios-sys-info --memory-dat=smbios_memory_file_zero
Bus error
$ /usr/sbin/smbios-sys-info-lite -m smbios_memory_file_zero
Libsmbios: 2.4.1
Bus error
This works as a non-privileged user as well. This is on a Dell Precision M6700 laptop.

The threshold is a bit below 1 MB: there's a crash with a file 0xFD000 (1036288) bytes large, no crash with a file 0xFE000 (1044480) bytes large.

AFAIK, such bus errors don't have potential for code execution. However, the program should still validate input data, complain and exit cleanly with a nonzero error code, instead of crashing :)
afl-fuzz and honggfuzz ( #43 ) should easily find this fault when invoking smbios-sys-info-lite -m @@ and smbios-sys-info-lite -m ___FILE___, respectively.

As part of #43, you'll have to expand the CLI of smbios-sys-info-lite, or make new front-ends, to make it easier to fuzz libsmbios. For instance, passing arbitrary, independent replacements of /sys/firmware/dmi/tables/DMI and /sys/firmware/dmi/tables/smbios_entry_point to the program. At this point, both are tied by the same prefix in smbios_get_table_firm_tables(), and none of the existing callers of smbios_table_factory() enables the unit testing mode.

Cleanups requested from Ubuntu security review

Some of these aren't applicable since C++ API was dropped, but they should all be reviewed and decisions made. Removing the factories may be problematic as they're used in other consumers of libsmbios (such as fwupd).

These came from: https://bugs.launchpad.net/ubuntu/+source/libsmbios/+bug/1603072/comments/14

  • compile with UBSAN and make sure it's clean
  • compile with ASAN and make sure it's clean
  • fix the readByteArray() / writeByteArray() to work on more than one byte
    at a time
  • replace auto_ptr with the correct replacements at each use
  • remove the factories altogether
  • refactor copy_mmap() / trycopy() / remap()
  • try afl-fuzz on the different tools

Move from autotools to meson

Many projects lately have been moving from autotools to meson. It makes the build process more predictable, easier to understand and most importantly fix problems with.

Build logs have lot of warnings

warning: Macro %build_python defined but not used within scope
warning: Macro %as_needed defined but not used within scope
warning: Macro %fdupes defined but not used within scope
warning: Macro %cppunit_BR defined but not used within scope
warning: Macro %valgrind_BR defined but not used within scope
warning: bogus date in %changelog: Fri Jul 06 2010 Michael Brown <michael-e_brown at dell.com> - 2.2.26-1
warning: bogus date in %changelog: Fri Jul 06 2010 Michael Brown <michael-e_brown at dell.com> - 2.2.25-1
warning: bogus date in %changelog: Mon Mar 24 2009 Michael E Brown <michael_e_brown at dell.com> - 2.2.16-1
warning: bogus date in %changelog: Mon Mar 24 2009 Michael E Brown <michael_e_brown at dell.com> - 2.2.15-1
warning: bogus date in %changelog: Tue Aug 6 2007 Michael E Brown <michael_e_brown at dell.com> - 0.13.8

Can't change keyboard backlight timeout on AC

Hi,

Not sure if I'm posting this in the right place, but would appreciate any help. I've got an XPS 13 9370, installed Fedora on it, and then updated the bios to 1.3.2 (downloaded from fwupd).

The problem: when the device is on AC power, the keyboard backlight always goes out in 3 seconds. So I tried two things:

  • echo "1h" > /sys/class/leds/dell::kbd_backlight/stop_timeout - but this works only on battery power. As soon as I plug in the charger, the keyboard backlight dims in 3 seconds.
  • smbios-keyboard-ctl --set-mode - but this gives me the same output as the guy in issue #41

memory leak in Fedora 30

fwupd CI is reporting this issue:

14/16 dell-self-test                          FAIL     0.12 s (exit status 1)
15/16 synapticsmst-self-test                  OK       0.04 s 
16/16 uefi-self-test                          OK       0.07 s 
Ok:                   14
Expected Fail:         0
Fail:                  1
Unexpected Pass:       0
Skipped:               1
Timeout:               0
The output from the failed tests:
14/16 dell-self-test                          FAIL     0.12 s (exit status 1)
--- command ---
/build/build/meson-private/dist-build/plugins/dell/dell-self-test
--- stdout ---
/fwupd/plugin{dell:tpm}: OK
/fwupd/plugin{dell:dock}: OK
--- stderr ---
ERROR:esys:src/tss2-esys/esys_tcti_default.c:210:get_tcti_default() No standard TCTI could be loaded 
ERROR:esys:src/tss2-esys/esys_context.c:68:Esys_Initialize() Initialize default tcti. ErrorCode (0x00070002) 
ERROR:esys:src/tss2-esys/esys_tcti_default.c:210:get_tcti_default() No standard TCTI could be loaded 
ERROR:esys:src/tss2-esys/esys_context.c:68:Esys_Initialize() Initialize default tcti. ErrorCode (0x00070002) 
ERROR:esys:src/tss2-esys/esys_tcti_default.c:210:get_tcti_default() No standard TCTI could be loaded 
ERROR:esys:src/tss2-esys/esys_context.c:68:Esys_Initialize() Initialize default tcti. ErrorCode (0x00070002) 
ERROR:esys:src/tss2-esys/esys_tcti_default.c:210:get_tcti_default() No standard TCTI could be loaded 
ERROR:esys:src/tss2-esys/esys_context.c:68:Esys_Initialize() Initialize default tcti. ErrorCode (0x00070002) 
=================================================================
==3002==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 546 byte(s) in 1 object(s) allocated from:
    #0 0x7f04b4a68e56 in __interceptor_calloc (/lib64/libasan.so.5+0x10de56)
    #1 0x7f04b4375fd5  (/lib64/libsmbios_c.so.2+0x28fd5)
    #2 0x554245445f435f52  (<unknown module>)
Direct leak of 73 byte(s) in 2 object(s) allocated from:
    #0 0x7f04b4a68c58 in __interceptor_malloc (/lib64/libasan.so.5+0x10dc58)
    #1 0x7f04b4143137 in __vasprintf_internal (/lib64/libc.so.6+0x7a137)
SUMMARY: AddressSanitizer: 619 byte(s) leaked in 3 allocation(s).
-------

CI doesn't run on Dell systems, but it seems that there is a memory leak somewhere in a failure path.

Issue with set asset on Centos7

Just recently moved from centos6 to centos7 and ran into an issue with setting an asset tag on my server. I have a fix but wanted to see if this is just something specific to my setup vs an actual issue with the library.

Version Info:

[root@localhost ~]# python3 --version
Python 3.4.8
[root@localhost ~]# uname -a
Linux localhost 3.10.0-693.21.1.el7.x86_64 #1 SMP Wed Mar 7 13:12:24 CST 2018 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost ~]# rpm -qa | grep smb
libsmbios-2.4.1-1.el7.centos.x86_64
smbios-utils-2.4.1-1.el7.centos.x86_64
python3-smbios-2.4.1-1.el7.centos.x86_64
smbios-utils-bin-2.4.1-1.el7.centos.x86_64
smbios-utils-python-2.4.1-1.el7.centos.x86_64

After all of the above is installed on the server I get the following when trying to set the asset tag.

[root@localhost ~]# smbios-sys-info --asset-tag --set=M0000003
Current tag value:
Asset Tag: M

Setting new tag value: M0000003
Traceback (most recent call last):
  File "/usr/sbin/smbios-sys-info", line 132, in <module>
    sys.exit( main() )
  File "/usr/sbin/smbios-sys-info", line 120, in main
    fn(options.set, options.password_ascii, options.password_scancode)
  File "/usr/lib64/python3.4/site-packages/libsmbios_c/trace_decorator.py", line 103, in trace
    result = func(*args, **kw)
  File "/usr/lib64/python3.4/site-packages/libsmbios_c/system_info.py", line 88, in set_asset_tag
    return DLL.sysinfo_set_asset_tag(newtag, pass_ascii, pass_scancode)
ctypes.ArgumentError: argument 1: <class 'TypeError'>: wrong type

The function that this is failing in look like this.

DLL.sysinfo_set_asset_tag.argtypes = [ctypes.c_char_p, ctypes.c_char_p, ctypes.c_char_p]
DLL.sysinfo_set_asset_tag.restype = ctypes.c_int
DLL.sysinfo_set_asset_tag.errcheck=errorOnNegativeFN(lambda r,f,a: _strerror())
@traceLog()
def set_asset_tag(newtag, pass_ascii=None, pass_scancode=None):

    return DLL.sysinfo_set_asset_tag(newtag, pass_ascii, pass_scancode)
__all__.append("set_asset_tag")

Digging around I found that ctypes.c_char_p is expecting to be passed in bytes and not just a string which I verified was happening via a print statement. Changing the return line above to below fixes the issue and sets the asset tag properly.

return DLL.sysinfo_set_asset_tag(newtag.encode(), pass_ascii, pass_scancode)

Other Notes:

Initially the rpm packages were a tad hard to install because I couldn't actually find any python3 packages for centos7 all I found was python34 and python36. This is more an issue with centos7 or just me being unable to find the proper packages but seems to be a common issue all around in centos from a few google searches. I ended up forcing the install with a rpm --nodeps since python3 is satisfied by python34 although rpm isn't smart enough to figure that out.

Cannot build without help2man

This is when building as a flatpak when there is no help2man available:

make[3]: Leaving directory '/run/build/libsmbios_c'
false --output=out/smbios-sys-info-lite.1 --name=out/smbios-sys-info-lite out/smbios-sys-info-lite
make[2]: [Makefile:2969: out/smbios-sys-info-lite.1] Error 1 (ignored)
false --output=out/smbios-get-ut-data.1 --name=out/smbios-get-ut-data out/smbios-get-ut-data
make[2]: [Makefile:2969: out/smbios-get-ut-data.1] Error 1 (ignored)
false --output=out/smbios-state-byte-ctl.1 --name=out/smbios-state-byte-ctl out/smbios-state-byte-ctl
make[2]: [Makefile:2969: out/smbios-state-byte-ctl.1] Error 1 (ignored)
false --output=out/smbios-upflag-ctl.1 --name=out/smbios-upflag-ctl out/smbios-upflag-ctl
make[2]: [Makefile:2969: out/smbios-upflag-ctl.1] Error 1 (ignored)
 /usr/bin/mkdir -p '/app/share/man/man1'
 /usr/bin/install -c -m 644 ./out/smbios-sys-info-lite.1 ./out/smbios-get-ut-data.1 ./out/smbios-state-byte-ctl.1 ./out/smbios-upflag-ctl.1 '/app/share/man/man1'
/usr/bin/install: cannot stat './out/smbios-sys-info-lite.1': No such file or directory
/usr/bin/install: cannot stat './out/smbios-get-ut-data.1': No such file or directory
/usr/bin/install: cannot stat './out/smbios-state-byte-ctl.1': No such file or directory
/usr/bin/install: cannot stat './out/smbios-upflag-ctl.1': No such file or directory

Notice the false -- that needs to be conditionalized before trying to build the .1 files.

SyntaxErrors after building

After building with from a git checkout, I can't get any smbios commands to run.
For instance:

> smbios-thermal-ctl
Returns
File "/usr/local/sbin/smbios-thermal-ctl", line 73
return ((num >> (byte_pos*8)) & 0xFF)
^
SyntaxError: invalid syntax

Different commands yield errors in different files.

I wanted to try the recommended build method, but when executing ./configure.ac I get another syntax error.
./configure.ac: line 14: syntax error near unexpected token [release_major_version],'
./configure.ac: line 14: m4_define([release_major_version], [2])'

Any help is appreciated, thanks.

drop libsmbios_c++

Nothing is using it in practice these days.
It's bulky.
It's easier, less error prone, and better to code once in a single language and then add bindings for others.
It's causing failures in CI:

g++ -DHAVE_CONFIG_H -I. -I./out/include  -I./out/include -I./src/include -DLIBSMBIOS_LOCALEDIR=\"/usr/local/share/locale\"  -DBUILD_LINUX  -I/usr/include/libxml2 -I./src/libsmbios_c++/common  -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -fPIC -std=c++98 -MT src/cppunit/out_testPlatform-testPlatform.o -MD -MP -MF src/cppunit/.deps/out_testPlatform-testPlatform.Tpo -c -o src/cppunit/out_testPlatform-testPlatform.o `test -f 'src/cppunit/testPlatform.cpp' || echo './'`src/cppunit/testPlatform.cpp
In file included from /usr/include/c++/7/type_traits:35:0,
                 from /usr/include/cppunit/tools/StringHelper.h:7,
                 from /usr/include/cppunit/TestAssert.h:8,
                 from /usr/include/cppunit/TestCase.h:6,
                 from /usr/include/cppunit/TestCaller.h:5,
                 from /usr/include/cppunit/extensions/HelperMacros.h:9,
                 from src/cppunit/testPlatform.h:24,
                 from src/cppunit/testPlatform.cpp:25:
/usr/include/c++/7/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
 #error This file requires compiler and library support \
  ^~~~~
In file included from /usr/include/cppunit/TestAssert.h:8:0,
                 from /usr/include/cppunit/TestCase.h:6,
                 from /usr/include/cppunit/TestCaller.h:5,
                 from /usr/include/cppunit/extensions/HelperMacros.h:9,
                 from src/cppunit/testPlatform.h:24,
                 from src/cppunit/testPlatform.cpp:25:
/usr/include/cppunit/tools/StringHelper.h:22:15: error: 'enable_if' in namespace 'std' does not name a template type
 typename std::enable_if<!std::is_enum<T>::value, std::string>::type toString(const T& x)
               ^~~~~~~~~
/usr/include/cppunit/tools/StringHelper.h:22:24: error: expected unqualified-id before '<' token
 typename std::enable_if<!std::is_enum<T>::value, std::string>::type toString(const T& x)
                        ^
/usr/include/cppunit/tools/StringHelper.h:31:15: error: 'enable_if' in namespace 'std' does not name a template type
 typename std::enable_if<std::is_enum<T>::value, std::string>::type toString(const T& x)
               ^~~~~~~~~
/usr/include/cppunit/tools/StringHelper.h:31:24: error: expected unqualified-id before '<' token
 typename std::enable_if<std::is_enum<T>::value, std::string>::type toString(const T& x)
                        ^
In file included from /usr/include/cppunit/TestCase.h:6:0,
                 from /usr/include/cppunit/TestCaller.h:5,
                 from /usr/include/cppunit/extensions/HelperMacros.h:9,
                 from src/cppunit/testPlatform.h:24,
                 from src/cppunit/testPlatform.cpp:25:
/usr/include/cppunit/TestAssert.h: In static member function 'static std::__cxx11::string CppUnit::assertion_traits<T>::toString(const T&)':
/usr/include/cppunit/TestAssert.h:74:42: error: 'toString' is not a member of 'CppUnit::StringHelper'
         return CPPUNIT_NS::StringHelper::toString(x);
                                          ^~~~~~~~
In file included from /usr/include/cppunit/extensions/HelperMacros.h:9:0,
                 from src/cppunit/testPlatform.h:24,
                 from src/cppunit/testPlatform.cpp:25:
/usr/include/cppunit/TestCaller.h: At global scope:
/usr/include/cppunit/TestCaller.h:159:37: error: 'std::function' has not been declared
   TestCaller(std::string name, std::function<void()> test_function, Fixture* fixture):
                                     ^~~~~~~~
/usr/include/cppunit/TestCaller.h:159:45: error: expected ',' or '...' before '<' token
   TestCaller(std::string name, std::function<void()> test_function, Fixture* fixture):
                                             ^
/usr/include/cppunit/TestCaller.h:200:8: error: 'function' in namespace 'std' does not name a template type
   std::function<void()> m_test_function;
        ^~~~~~~~
/usr/include/cppunit/TestCaller.h: In constructor 'CppUnit::TestCaller<Fixture>::TestCaller(std::__cxx11::string, CppUnit::TestCaller<Fixture>::TestMethod)':
/usr/include/cppunit/TestCaller.h:121:6: error: class 'CppUnit::TestCaller<Fixture>' does not have any field named 'm_test_function'
      m_test_function( std::bind(test, m_fixture) )
      ^~~~~~~~~~~~~~~
/usr/include/cppunit/TestCaller.h:121:28: error: 'bind' is not a member of 'std'
      m_test_function( std::bind(test, m_fixture) )
                            ^~~~
/usr/include/cppunit/TestCaller.h:121:28: note: suggested alternative: 'find'
      m_test_function( std::bind(test, m_fixture) )
                            ^~~~
                            find
/usr/include/cppunit/TestCaller.h: In constructor 'CppUnit::TestCaller<Fixture>::TestCaller(std::__cxx11::string, CppUnit::TestCaller<Fixture>::TestMethod, Fixture&)':
/usr/include/cppunit/TestCaller.h:138:6: error: class 'CppUnit::TestCaller<Fixture>' does not have any field named 'm_test_function'
      m_test_function( std::bind(test, &fixture) )
      ^~~~~~~~~~~~~~~
/usr/include/cppunit/TestCaller.h:138:28: error: 'bind' is not a member of 'std'
      m_test_function( std::bind(test, &fixture) )
                            ^~~~
/usr/include/cppunit/TestCaller.h:138:28: note: suggested alternative: 'find'
      m_test_function( std::bind(test, &fixture) )
                            ^~~~
                            find
/usr/include/cppunit/TestCaller.h: In constructor 'CppUnit::TestCaller<Fixture>::TestCaller(std::__cxx11::string, CppUnit::TestCaller<Fixture>::TestMethod, Fixture*)':
/usr/include/cppunit/TestCaller.h:155:6: error: class 'CppUnit::TestCaller<Fixture>' does not have any field named 'm_test_function'
      m_test_function( std::bind(test, fixture) )
      ^~~~~~~~~~~~~~~
/usr/include/cppunit/TestCaller.h:155:28: error: 'bind' is not a member of 'std'
      m_test_function( std::bind(test, fixture) )
                            ^~~~
/usr/include/cppunit/TestCaller.h:155:28: note: suggested alternative: 'find'
      m_test_function( std::bind(test, fixture) )
                            ^~~~
                            find
/usr/include/cppunit/TestCaller.h: In constructor 'CppUnit::TestCaller<Fixture>::TestCaller(std::__cxx11::string, int)':
/usr/include/cppunit/TestCaller.h:162:17: error: 'fixture' was not declared in this scope
       m_fixture(fixture),
                 ^~~~~~~
/usr/include/cppunit/TestCaller.h:162:17: note: suggested alternative: 'Fixture'
       m_fixture(fixture),
                 ^~~~~~~
                 Fixture
/usr/include/cppunit/TestCaller.h:163:7: error: class 'CppUnit::TestCaller<Fixture>' does not have any field named 'm_test_function'
       m_test_function(test_function)
       ^~~~~~~~~~~~~~~
/usr/include/cppunit/TestCaller.h:163:23: error: 'test_function' was not declared in this scope
       m_test_function(test_function)
                       ^~~~~~~~~~~~~
/usr/include/cppunit/TestCaller.h: In member function 'void CppUnit::TestCaller<Fixture>::runTest()':
/usr/include/cppunit/TestCaller.h:175:7: error: there are no arguments to 'm_test_function' that depend on a template parameter, so a declaration of 'm_test_function' must be available [-fpermissive]
       m_test_function();
       ^~~~~~~~~~~~~~~
/usr/include/cppunit/TestCaller.h:175:7: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
In file included from /usr/include/cppunit/extensions/HelperMacros.h:14:0,
                 from src/cppunit/testPlatform.h:24,
                 from src/cppunit/testPlatform.cpp:25:
/usr/include/cppunit/extensions/TestNamer.h: In member function 'std::__cxx11::string CppUnit::TestNamer::getTestNameFor(const string&, const E&) const':
/usr/include/cppunit/extensions/TestNamer.h:70:95: error: 'toString' is not a member of 'CppUnit::StringHelper'
 r(testMethodName) + " with parameter: " + CPPUNIT_NS::StringHelper::toString(val);
                                                                     ^~~~~~~~
In file included from src/cppunit/testPlatform.h:24:0,
                 from src/cppunit/testPlatform.cpp:25:
src/cppunit/testPlatform.h: In static member function 'static CppUnit::TestSuite* testPlatform::suite()':
src/cppunit/testPlatform.h:129:5: error: 'unique_ptr' is not a member of 'std'
     CPPUNIT_TEST_SUITE_END ();
     ^
src/cppunit/testPlatform.h:129:5: error: expected primary-expression before '>' token
     CPPUNIT_TEST_SUITE_END ();
     ^
src/cppunit/testPlatform.h:129:5: error: 'guard' was not declared in this scope
     CPPUNIT_TEST_SUITE_END ();
     ^
In file included from /usr/include/cppunit/extensions/HelperMacros.h:9:0,
                 from src/cppunit/testPlatform.h:24,
                 from src/cppunit/testPlatform.cpp:25:
/usr/include/cppunit/TestCaller.h: In instantiation of 'void CppUnit::TestCaller<Fixture>::runTest() [with Fixture = testPlatform]':
src/cppunit/testPlatform.cpp:859:1:   required from here
/usr/include/cppunit/TestCaller.h:175:22: error: 'm_test_function' was not declared in this scope
       m_test_function();
       ~~~~~~~~~~~~~~~^~
/usr/include/cppunit/TestCaller.h:175:22: note: suggested alternative: '__fortify_function'
       m_test_function();
       ~~~~~~~~~~~~~~~^~
       __fortify_function
Makefile:3005: recipe for target 'src/cppunit/out_testPlatform-testPlatform.o' failed

Segfault with smbios-keyboard-ctl

Hey, so I'm trying to use libsmbios on my Dell XPS 13 Project Sputnik machine. When I run smbios-keyboard-ctl -g or smbios-keyboard-ctl -i I get a seg fault. I'd like to give you a stack trace but I'm not sure how to build libsmbios with debugging symbols.

Prebuilt rpm/deb packages

I have found a few links online to places where prebuilt packages of libsmbios were available from dell however all of them 404 now. Do you still provide this prebuilt?

Latitude E5470 keyboard backlight support

Hi 😄

My E5470 with the current linux tree driver turns on the backlight when linux boots, and logs some errors.
I am trying to bring support for it, and after cross-checking with this lib, I see it also gives some errors with my laptop.

sudo ./smbios-sys-info
Libsmbios version:      2.3.1
Product Name:           Latitude E5470
Vendor:                 Dell Inc.
BIOS Version:           1.9.4
sudo ./smbios-keyboard-ctl -g
Helper function to print current status of keyboard illumination

 Current status of KeyBoard Illumination setting on your system: 
-------------------------------------------------------------------

 Configured mode state: 
	 Auto: Input-activity-based On (illumination level 100%); input-activity based Off

 Your Keyboard will illumination on: 
	Any Keystroke
	Touchpad activity

 Keyboard illumination timeout has bee set at: 10  Seconds

 Current setting of ALS value that turns the light on or off: 0
 Current ALS Reading : 0
 Current keyboard light level : 0
sudo ./smbios-keyboard-ctl --set-mode
Setting USER Selectable Keyboard Mode

 Supported USER Selectable Modes: 
	Option	Mode
------------------------------------------------
	0	Always OFF
	1	Always ON
	6	Auto: Input-activity-based On (illumination level 50%); input-activity based Off
	8	Auto: Input-activity-based On (illumination level 100%); input-activity based Off

 Note: some modes might need the keyboard set at specific illumination levels

Select Mode: 0
	  Set Trigger Failed. Failed to write config
	 Error Return Code : cbRES1: 0x-2 cbRES2: 0xA000000 cbRES3: 0x0 


Fails to find gcc.h

Compiling inside flatpak I get:

In file included from /app/include/smbios_c/compat.h:27:0,
                 from /app/include/smbios_c/smi.h:22:
/app/include/smbios_c/config/get_config.h:36:39: fatal error: smbios_c/config/compiler/gcc.h: No such file or directory
 #  include LIBSMBIOS_C_COMPILER_CONFIG

Looking at the builddir I see:

$ ls build-dir/files/include/smbios_c/config/
abi_prefix.h  auto_link.h  get_config.h  msvc_prefix.h  select_compiler_config.h  suffix.h     user.h     win32.h
abi_suffix.h  gcc.h        linux.h       msvc_suffix.h  select_platform_config.h  sunpro_cc.h  visualc.h  win64.h

But select_compiler_config.h is looking for smbios_c/config/compiler/gcc.h -- i.e. with a compiler/ prefix that doesn't exist in reality. Either the gcc.h header is installed in the wrong directory (and sunpro_cc.h and visual_c.h) or the include is wrong.

ERROR: Could not manipulate system token.

Dell Latitude E6430. Ubuntu 18.04, Kernel 4.15

Running:

sudo smbios-token-ctl

Getting 29 tokens, and the 30th is error:

  Token: 0x007d - LCD Brightness (Value)
ERROR: Could not manipulate system token.

I was trying to 'patch' /usr/sbin/smbios-token-ctl and successfully escape LCD token, but after this there is the other 'Could not manipulate system token' with many other tokens

Sum up: Got 70 tokens, blacklisted these tokens:

0x007d,"LCD Brightness (Value)"
0x0140,"CPU XD Support (Off)"
0x0141,"CPU XD Support (Enabled)"
0x0146,"USB Wake Support (Off)"
0x0147,"USB Wake Support (Enabled)"
0x014a,"CPU Virtualization (Disabled)"
0x014b,"CPU Virtualization (Enabled)"
0x0152,"Bluetooth Devices (Enabled)"
0x0153,"Bluetooth Devices (Disabled)"
0x017b,"Cellular Radio (Disable)"

and it'is not end. I have not found the option to automatically escape broken tokens. Maybe I did something bad and broke something on my notebook?)

PS - my target is make my fan work full speed, 70-80°C without huge load, and over 90-95°C with 2/8 cores used is not pretty good)

smbios-sys-info-lite works but not smbios-sys-info

Using libsmbios-2.4.2, "make install" installs /usr/local/share/smbios-utils/cli.py, but python does not find it in this location:

smbios-lcd-brightness
Traceback (most recent call last):
File "/usr/local/sbin/smbios-lcd-brightness", line 32, in
import cli
ModuleNotFoundError: No module named 'cli'

After copying cli.py to /usr/local/lib/python3.6/site-packages/ then things start to work:

$ sudo smbios-sys-info-lite
Libsmbios: 2.4.2
System ID: 0x05CA
Service Tag: 2FDPF12
Express Service Code: 5283578198
Asset Tag: Not Specified
Product Name: Latitude E7240
BIOS Version: A27
Vendor: Dell Inc.
Is Dell: 1
...

..but
$ sudo smbios-sys-info
Traceback (most recent call last):
File "/usr/local/sbin/smbios-sys-info", line 132, in
sys.exit( main() )
File "/usr/local/sbin/smbios-sys-info", line 86, in main
cli.setup_std_options(options)
File "/usr/local/lib/python3.6/site-packages/cli.py", line 85, in setup_std_options
setupLogging(options.logconfig, options.verbosity, options.trace)
File "/usr/local/lib/python3.6/site-packages/cli.py", line 93, in setupLogging
logging.config.fileConfig(configFile)
File "/usr/local/lib/python3.6/logging/config.py", line 76, in fileConfig
formatters = _create_formatters(cp)
File "/usr/local/lib/python3.6/logging/config.py", line 109, in _create_formatters
flist = cp["formatters"]["keys"]
File "/usr/local/lib/python3.6/configparser.py", line 959, in getitem
raise KeyError(key)
KeyError: 'formatters'

Is the problem that it cannot find /usr/local/etc/libsmbios/logging.conf?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.