File: fix-endianness-issue-in-parser.py.patch

package info (click to toggle)
python-xiaomi-ble 1.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 860 kB
  • sloc: python: 5,909; makefile: 13
file content (22 lines) | stat: -rw-r--r-- 805 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
From: Bastian Blank <waldi@debian.org>
Date: Sat, 24 May 2025 10:34:55 +0200
X-Dgit-Generated: 0.36.0-1.1 e56eebaa11ee68d6e0809864b04969f94ae3b636
Subject: Fix endianness issue in parser.py

Closes: #1103588

---

diff --git a/src/xiaomi_ble/parser.py b/src/xiaomi_ble/parser.py
index 2bf04da..4a82861 100644
--- a/src/xiaomi_ble/parser.py
+++ b/src/xiaomi_ble/parser.py
@@ -1171,7 +1171,7 @@ def obj4a08(
     xobj: bytes, device: XiaomiBluetoothDeviceData, device_type: str
 ) -> dict[str, Any]:
     """Motion detected with Illuminance in lux"""
-    (illum,) = struct.unpack("f", xobj)
+    (illum,) = struct.unpack("<f", xobj)
     device.update_predefined_binary_sensor(BinarySensorDeviceClass.MOTION, True)
     device.update_predefined_sensor(SensorLibrary.LIGHT__LIGHT_LUX, illum)
     return {}