galaxy book5 sensors on linux
After sorting out the whole issue of bluetooth firmware on my laptop, my next target was the integrated sensor hub (ISH). The ISH is an Intel-designed component that polls sensors automatically and makes getting their data much easier for the OS. Or something along those lines — either way, getting this hub working would mean that the lid sensor and accelerometer would be usable, and so tablet mode should “just work” in KDE.
Investigation
Looking through lspci
, I saw that the driver was
already loaded:
00:12.0 Serial controller [0700]: Intel Corporation Lunar Lake-M Integrated Sensor Hub [8086:a845] (rev 10)
DeviceName: Onboard - Other
Subsystem: Samsung Electronics Co Ltd Device [144d:c1da]
Kernel driver in use: intel_ish_ipc
Kernel modules: 8250_pci, intel_ish_ipc
This was pretty weird because nothing was showing
up in /sys/bus/iio
, where the sensors should be if they
were accessible. In the kernel logs, it was clear that the
driver wasn’t working right:
[ 4.416718] intel_ish_ipc 0000:00:12.0: ISH loader: load firmware: intel/ish/ish_lnlm.bin
[ 4.430675] intel_ish_ipc 0000:00:12.0: ISH loader: cmd 2 failed 10
[ 4.448263] intel_ish_ipc 0000:00:12.0: ISH loader: cmd 2 failed 10
[ 4.467844] intel_ish_ipc 0000:00:12.0: ISH loader: cmd 2 failed 10
The documentation for ISH kernel driver shows that it should “just work” out of box, as long as the OEM didn’t create custom ISH firmware which wasn’t upstreamed. I didn’t think this was the case as on Windows, the driver shown in Device Manager was just the stock Intel one, with nothing indicating Samsung modifications.
At this point, I decided to email the maintainers
of the intel-ish-ipc
driver, and I got a response
the next day! (Once I remembered to actually CC them
on the mailing list, that is.) The maintainer explained
that the hub probably needed Samsung’s custom firmware,
which confused me for a bit considering I didn’t see
how it could be provided on Windows, where the sensors
were clearly working fine.
Search
After digging a little bit
through the C:\Windows
folder, I found a driver
called IshHeciExtensionTemplate
which had a FwImage
folder! This didn’t show up in Device Manager
at all, which is why I missed it on my first look.
Notably, the firmware image in this folder
was only around 650 KiB, instead of the 975 KiB
image which the main driver and linux-firmware provided.
The INF file made it clear that it was a Samsung
extension, with this section:
[Strings]
; Needed changes: Specify your vendor name here
ManufacturerName="Samsung Electronics Co., Ltd."
VendorName = "Samsung Electronics Co., Ltd."
I brought the driver folder over to linux, and got to work trying to load it. The ISH driver docs explain how it looks for the right firmware to load, which is just picking the first file that exists in this list:
intel/ish/ish_${intel_plat_gen}_${SYS_VENDOR_CRC32}_${PRODUCT_NAME_CRC32}_${PRODUCT_SKU_CRC32}.bin
intel/ish/ish_${intel_plat_gen}_${SYS_VENDOR_CRC32}_${PRODUCT_SKU_CRC32}.bin
intel/ish/ish_${intel_plat_gen}_${SYS_VENDOR_CRC32}_${PRODUCT_NAME_CRC32}.bin
intel/ish/ish_${intel_plat_gen}_${SYS_VENDOR_CRC32}.bin
intel/ish/ish_${intel_plat_gen}.bin
The only ISH firmware in the upstream linux-firmware repo
was ish_lnlm.bin
, so inserting the firmware as
ish_${intel_plat_gen}_${SYS_VENDOR_CRC32}.bin
should be enough to get it to load. I got the vendor
string from /sys/class/dmi/id/sys_vendor
, which was
the same SAMSUNG ELECTRONICS CO., LTD.
as from the Windows
driver, passed it through some online CRC32 site,
and dropped the new firmware into my linux-firmware
package as intel/ish/ish_lnlm_053dca6a.bin
.
One reboot later, and I saw iio-sensor-proxy
was actually running, and tablet mode/screen rotation
was fully working! I was kinda surprised that it
worked first try.
Publish
The only issue left was getting this into the hands of others who need it. Unfortunately, Samsung doesn’t care at all about linux support, so unlike with the bluetooth firmware, I couldn’t just wait for the vendor to publish to linux-firmware later.
On top of that, the firmware is completely unlicensed, apart from the big INTEL PROPRIETARY header in the INF file, which is probably just a leftover from the messily edited template file. And without a license, it can’t be assumed to be redistributable and certainly won’t be accepted to linux-firmware if I submitted it myself.
The Microsoft Update Catalog has the following to say about the license terms:
What are the legal terms for using Microsoft Update Catalog?
Your use of the Microsoft Update Catalog is subject to the Terms of Use. Software updates you receive through the Microsoft Update Catalog are governed by any license terms that come with them. If no license terms come with them, they may be governed by the original license agreement for the software to which they apply. You should check that license agreement for details.
Both the “any license terms that come with them” and “original license agreement for the software to which they apply” here seem to point to the “INTEL PROPRIETARY” license information, which explicitly forbids any kind of redistribution without written permission from Intel:
;*******************************************************************************
;* **
;* I N T E L P R O P R I E T A R Y **
;* **
;* COPYRIGHT (c) 2012-2024 BY INTEL CORPORATION. ALL RIGHTS RESERVED. NO **
;* PART OF THIS PROGRAM OR PUBLICATION MAY BE REPRODUCED, TRANSMITTED, **
;* TRANSCRIBED, STORED IN A RETRIEVAL SYSTEM, OR TRANSLATED INTO ANY **
;* LANGUAGE OR COMPUTER LANGUAGE IN ANY FORM OR BY ANY MEANS, ELECTRONIC, **
;* MECHANICAL, MAGNETIC, OPTICAL, CHEMICAL, MANUAL, OR OTHERWISE, WITHOUT **
;* THE PRIOR WRITTEN PERMISSION OF : **
;* **
;* INTEL CORPORATION **
;* **
;* 2200 MISSION COLLEGE BLVD **
;* **
;* SANTA CLARA, CALIFORNIA 95052-8119 **
;* **
;*******************************************************************************
If someone wants to try writing them a letter, be sure to tell me how it goes…
Do It Yourself
Thankfully for any other linux-using Book5 owners,
as long as you still have a windows partition
or the 19GB OEM recovery partition, the firmware is easy
to get and install. It’s located in the folder
/Windows/System32/DriverStore/FileRepository/ishheciextensiontemplate.inf_amd64_????????????????/FwImage/0003/
(where 0003 indicates the Lunar Lake platform).
The unknown part is a semi-random hex value, probably the
Windows Update version identifier for the driver, and was
29445c37f90c085b
on my recovery image, and f5d3f42bdf58e17b
on my main installation. In the 0003
folder, there should
be a file named something like ishS_SI_5.8.0.7720.bin
(or the older version 7718 on the recovery environment).
Install that file into your /lib/firmware
folder
as intel/ish/ish_lnlm_053dca6a.bin
and the sensors
should Just Work on next boot. For some reason
unloading and inserting the kernel module doesn’t
work, a full reboot is needed.
Easy enough to do on NixOS:
nixpkgs.overlays = [
(final: prev: {
linux-firmware = prev.linux-firmware.overrideAttrs (old: {
postInstall = ''
cp ${./ishS_SI_5.8.0.7720.bin} $out/lib/firmware/intel/ish/ish_lnlm_053dca6a.bin
'';
});
})
];