GID1 file reading error in MBIM device
We cannot blindly run a binary UICC read with "read size = 0" because the firmware may decide to return different results on different runs:
localhost ~ # sudo mbimcli -p -d /dev/wwan0mbim0 --ms-query-uicc-read-binary="application-id=A0000000871002FFFFFFFF8903020000,file-path=7FFF6F3F"
[/dev/wwan0mbim0] UICC file binary read:
Status word 1: 144
Status word 2: 0
Data: FF:FF
localhost ~ # sudo mbimcli -p -d /dev/wwan0mbim0 --ms-query-uicc-read-binary="application-id=A0000000871002FFFFFFFF8903020000,file-path=7FFF6F3F"
[/dev/wwan0mbim0] UICC file binary read:
Status word 1: 144
Status word 2: 0
Data: FF:FF:08:00:9C:01:4A:27:F2:F2:F2:F2:08:00:00:00:F2:F2:F2:F2:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF
Instead, we should run a UICC file status query to know the size of the file being read, and then read exactly that amount of bytes:
localhost ~ # sudo mbimcli -p -d /dev/wwan0mbim0 --ms-query-uicc-file-status="application-id=A0000000871002FFFFFFFF8903020000,file-path=7FFF6F3F"
[/dev/wwan0mbim0] UICC file status retrieved:
Status word 1: 144
Status word 2: 0
Accessibility: not-shareable
Type: working-ef
Structure: transparent
Item count: 1
Item size: 2
Access conditions:
Read: pin1
Update: unknown
Activate: unknown
Deactivate: unknown
localhost ~ # sudo mbimcli -p -d /dev/wwan0mbim0 --ms-query-uicc-read-binary="application-id=A0000000871002FFFFFFFF8903020000,file-path=7FFF6F3F,read-size=2"
[/dev/wwan0mbim0] UICC file binary read:
Status word 1: 144
Status word 2: 0
Data: FF:FF
We should be able to avoid things like this:
localhost ~ # mmcli -i 4
-------------------------------
General | path: /org/freedesktop/ModemManager1/SIM/4
-------------------------------
Properties | active: yes
| imsi: XXXXXXXX
| iccid: XXXXXXXX
| operator id: 310280
| operator name: AT&T
| gid1: 53FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
| type: physical
| removability: removable