python example.py --mac E7:39:2F:DB:D9:E1 --init
2023-04-05 14:49:49,299 MiBand2 (INFO) > Connecting to E7:39:2F:DB:D9:E1
2023-04-05 14:49:50,739 MiBand2 (INFO) > Connected
2023-04-05 14:50:02,146 MiBand2 (INFO) > Enabling Auth Service notifications status...
2023-04-05 14:50:02,388 MiBand2 (INFO) > Sending Key...
2023-04-05 14:50:03,788 MiBand2 (INFO) > Requesting random number...
2023-04-05 14:50:03,938 MiBand2 (INFO) > Sending encrypted random number
Traceback (most recent call last):
File "/home/vkudak/software/MiBand2/MiBand2-master/example.py", line 23, in
if band.initialize():
File "/home/vkudak/software/MiBand2/MiBand2-master/base.py", line 308, in initialize
self.waitForNotifications(0.1)
File "/usr/local/lib/python3.10/dist-packages/bluepy/btle.py", line 560, in waitForNotifications
resp = self._getResp(['ntfy','ind'], timeout)
File "/usr/local/lib/python3.10/dist-packages/bluepy/btle.py", line 416, in _getResp
self.delegate.handleNotification(hnd, data)
File "/home/vkudak/software/MiBand2/MiBand2-master/base.py", line 28, in handleNotification
self.device._req_rdn()
File "/home/vkudak/software/MiBand2/MiBand2-master/base.py", line 208, in _req_rdn
self.waitForNotifications(self.timeout)
File "/usr/local/lib/python3.10/dist-packages/bluepy/btle.py", line 560, in waitForNotifications
resp = self._getResp(['ntfy','ind'], timeout)
File "/usr/local/lib/python3.10/dist-packages/bluepy/btle.py", line 416, in _getResp
self.delegate.handleNotification(hnd, data)
File "/home/vkudak/software/MiBand2/MiBand2-master/base.py", line 34, in handleNotification
self.device._send_enc_rdn(random_nr)
File "/home/vkudak/software/MiBand2/MiBand2-master/base.py", line 212, in _send_enc_rdn
cmd = self._send_enc_key + self._encrypt(data)
File "/home/vkudak/software/MiBand2/MiBand2-master/base.py", line 197, in _encrypt
aes = AES.new(self._KEY, AES.MODE_ECB)
File "/usr/local/lib/python3.10/dist-packages/Crypto/Cipher/AES.py", line 95, in new
return AESCipher(key, *args, kwargs)
File "/usr/local/lib/python3.10/dist-packages/Crypto/Cipher/AES.py", line 59, in init
blockalgo.BlockAlgo.init(self, _AES, key, *args, *kwargs)
File "/usr/local/lib/python3.10/dist-packages/Crypto/Cipher/blockalgo.py", line 141, in init
self._cipher = factory.new(key, args, kwargs)
SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats
Python 3.10 Kernel 5.15.0-69-generic
Cannot init device or do something else
python example.py --mac E7:39:2F:DB:D9:E1 --init 2023-04-05 14:49:49,299 MiBand2 (INFO) > Connecting to E7:39:2F:DB:D9:E1 2023-04-05 14:49:50,739 MiBand2 (INFO) > Connected 2023-04-05 14:50:02,146 MiBand2 (INFO) > Enabling Auth Service notifications status... 2023-04-05 14:50:02,388 MiBand2 (INFO) > Sending Key... 2023-04-05 14:50:03,788 MiBand2 (INFO) > Requesting random number... 2023-04-05 14:50:03,938 MiBand2 (INFO) > Sending encrypted random number Traceback (most recent call last): File "/home/vkudak/software/MiBand2/MiBand2-master/example.py", line 23, in
if band.initialize():
File "/home/vkudak/software/MiBand2/MiBand2-master/base.py", line 308, in initialize
self.waitForNotifications(0.1)
File "/usr/local/lib/python3.10/dist-packages/bluepy/btle.py", line 560, in waitForNotifications
resp = self._getResp(['ntfy','ind'], timeout)
File "/usr/local/lib/python3.10/dist-packages/bluepy/btle.py", line 416, in _getResp
self.delegate.handleNotification(hnd, data)
File "/home/vkudak/software/MiBand2/MiBand2-master/base.py", line 28, in handleNotification
self.device._req_rdn()
File "/home/vkudak/software/MiBand2/MiBand2-master/base.py", line 208, in _req_rdn
self.waitForNotifications(self.timeout)
File "/usr/local/lib/python3.10/dist-packages/bluepy/btle.py", line 560, in waitForNotifications
resp = self._getResp(['ntfy','ind'], timeout)
File "/usr/local/lib/python3.10/dist-packages/bluepy/btle.py", line 416, in _getResp
self.delegate.handleNotification(hnd, data)
File "/home/vkudak/software/MiBand2/MiBand2-master/base.py", line 34, in handleNotification
self.device._send_enc_rdn(random_nr)
File "/home/vkudak/software/MiBand2/MiBand2-master/base.py", line 212, in _send_enc_rdn
cmd = self._send_enc_key + self._encrypt(data)
File "/home/vkudak/software/MiBand2/MiBand2-master/base.py", line 197, in _encrypt
aes = AES.new(self._KEY, AES.MODE_ECB)
File "/usr/local/lib/python3.10/dist-packages/Crypto/Cipher/AES.py", line 95, in new
return AESCipher(key, *args, kwargs)
File "/usr/local/lib/python3.10/dist-packages/Crypto/Cipher/AES.py", line 59, in init
blockalgo.BlockAlgo.init(self, _AES, key, *args, *kwargs)
File "/usr/local/lib/python3.10/dist-packages/Crypto/Cipher/blockalgo.py", line 141, in init
self._cipher = factory.new(key, args, kwargs)
SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats