Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't Send APDU: Error executing command: error: operation failed: Unknown status 0x87430003 #8

Open
bam80 opened this issue Jun 7, 2024 · 28 comments

Comments

@bam80
Copy link
Contributor

bam80 commented Jun 7, 2024

The modem is Fibocom L860GL-16.

Logic Channel seems successfully open but then Send APDU: part fails, I tried different commands:

$ DEBUG=1 ./wrapper.py chip info
recv={"type":"apdu","payload":{"func":"connect","param":null}}
INFO: Connect
send={"type": "apdu", "payload": {"ecode": 0}}
recv={"type":"apdu","payload":{"func":"logic_channel_open","param":"a0000005591010ffffffff8900000100"}}
INFO: Open channel with AID a0000005591010ffffffff8900000100
send={"type": "apdu", "payload": {"ecode": 1}}
recv={"type":"apdu","payload":{"func":"transmit","param":"81e2910006bf3e035c015a"}}
Send APDU: 81e2910006bf3e035c015a
Error executing command: error: operation failed: Unknown status 0x87430003

Traceback (most recent call last):
  File "/var/home/bam/lpac/output/./wrapper.py", line 159, in <module>
    main()
  File "/var/home/bam/lpac/output/./wrapper.py", line 144, in main
    payload = handle_type_apdu(req["payload"]["func"], req["payload"]["param"])
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/home/bam/lpac/output/./wrapper.py", line 92, in handle_type_apdu
    data = send_apdu(param)
           ^^^^^^^^^^^^^^^^
  File "/var/home/bam/lpac/output/./wrapper.py", line 35, in send_apdu
    output_cmd = run_mbimcli(f'--ms-set-uicc-apdu="channel={CHANNEL_ID},command={apdu}"').split('\n')
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'split'

⬢[bam@toolbox output]$ mbimcli --device=/dev/cdc-wdm0 --intel-modem-reboot
[/dev/cdc-wdm0] Successfully requested modem to reboot for firmware update

⬢[bam@toolbox output]$ DEBUG=1 ./wrapper.py profile list
recv={"type":"apdu","payload":{"func":"connect","param":null}}
INFO: Connect
send={"type": "apdu", "payload": {"ecode": 0}}
recv={"type":"apdu","payload":{"func":"logic_channel_open","param":"a0000005591010ffffffff8900000100"}}
INFO: Open channel with AID a0000005591010ffffffff8900000100
send={"type": "apdu", "payload": {"ecode": 1}}
recv={"type":"apdu","payload":{"func":"transmit","param":"81e2910003bf2d00"}}
Send APDU: 81e2910003bf2d00
Error executing command: error: operation failed: Unknown status 0x87430003

Traceback (most recent call last):
  File "/var/home/bam/lpac/output/./wrapper.py", line 159, in <module>
    main()
  File "/var/home/bam/lpac/output/./wrapper.py", line 144, in main
    payload = handle_type_apdu(req["payload"]["func"], req["payload"]["param"])
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/home/bam/lpac/output/./wrapper.py", line 92, in handle_type_apdu
    data = send_apdu(param)
           ^^^^^^^^^^^^^^^^
  File "/var/home/bam/lpac/output/./wrapper.py", line 35, in send_apdu
    output_cmd = run_mbimcli(f'--ms-set-uicc-apdu="channel={CHANNEL_ID},command={apdu}"').split('\n')
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'split'

Also, if I open the Channel manually and then try to immediately close, it fails:

 $ mbimcli -d /dev/cdc-wdm0 --ms-set-uicc-open-channel="application-id=a0000005591010ffffffff8900000100" 
Succesfully retrieved open channel info:
	  status: 144
	 channel: 1
	response: (null)

$ mbimcli -d /dev/cdc-wdm0 --ms-set-uicc-close-channel="channel=1"
error: operation failed: Unknown status 0x87430003

What could I else try to diagnose it?

@abrasive @z3ntu

@stich86
Copy link
Owner

stich86 commented Jun 7, 2024

have you tried using -p on mbimcli?

@bam80
Copy link
Contributor Author

bam80 commented Jun 7, 2024

I stopped the ModemManager and had to remove the -p option from the script as otherwise it doesn't work:

$ mbimcli -d /dev/cdc-wdm0 --ms-set-uicc-open-channel="application-id=a0000005591010ffffffff8900000100" -p
error: couldn't open the MbimDevice: Couldn't spawn the mbim-proxy
$

@stich86
Copy link
Owner

stich86 commented Jun 7, 2024

eSIM is working under Windows?

@bam80
Copy link
Contributor Author

bam80 commented Jun 7, 2024

I didn't try particular exemplar yet, but overall it does.
Don't have Windows on hands, might have tomorrow.

@stich86
Copy link
Owner

stich86 commented Jun 7, 2024

Succesfully retrieved open channel info: status: 144 channel: 1 response: (null)

I don't see response here.. are you swapped slot to use eSIM one?

@bam80
Copy link
Contributor Author

bam80 commented Jun 7, 2024

Yes, otherwise, it can't open the Channel.

@stich86
Copy link
Owner

stich86 commented Jun 7, 2024

but you should get an APDU response and it doesn't reply, that's very stange..

@bam80
Copy link
Contributor Author

bam80 commented Jun 7, 2024

So you think Windows won't help here?

@stich86
Copy link
Owner

stich86 commented Jun 7, 2024

if you can test this module on Windows it's better, just to see if the eSIM can be accessed and profiled

@bam80
Copy link
Contributor Author

bam80 commented Jun 7, 2024

If it works on Windows, do you know some USB sniffing techniques to debug it?

@bam80
Copy link
Contributor Author

bam80 commented Jun 8, 2024

So I've got the Windows for two days, and apparently eSIM does work there.
I don't have any eSIM profile to test completely, though.

But I can enter "Manage eSIM profiles" screen, see EID there and QR code with eSIM properties, and can "Add a new profile".

If you have any other test procedure in mind, please let me know.
Thanks.

@bam80
Copy link
Contributor Author

bam80 commented Jun 10, 2024

eSIM is working under Windows?

@stich86 Yes, at least I can add a profile:
image

@septs
Copy link

septs commented Jun 12, 2024

recommended, you contact fibocom FAE engineer.
this a mobile module cannot close the channel, i think it is a firmware bug.

@bam80
Copy link
Contributor Author

bam80 commented Jun 12, 2024

@septs as you see above this module works on Windows perfectly fine

@septs
Copy link

septs commented Jun 12, 2024

$ mbimcli -d /dev/cdc-wdm0 --ms-set-uicc-close-channel="channel=1"
error: operation failed: Unknown status 0x87430003

obviously this module unsupported this method to close the channel, isn't this a bug?

so you should contact fibocom FAE engineer resolve this problem.

@stich86
Copy link
Owner

stich86 commented Jun 12, 2024

may be you can try to use wireshark and check which commands are sent to open logical channel and all other stuff:

https://paldan.altervista.org/wireshark-usbpcap-debugging-mbim-modem/?doing_wp_cron=1718179100.4425659179687500000000

@septs
Copy link

septs commented Jun 12, 2024

or reverse engineering to match microsoft behavior

of course, i think this repo owner will not make a workaround for this special module

@bam80
Copy link
Contributor Author

bam80 commented Jun 12, 2024

obviously this module unsupported this method to close the channel, isn't this a bug?

We saw the same behavior with other module, so the problem is with something else:
z3ntu/lpac-libqmi-wrapper#1 (comment)

@stich86 how did you solve it?

(Thanks for the Wireshark link, I was going to try it)

@stich86
Copy link
Owner

stich86 commented Jun 12, 2024

obviously this module unsupported this method to close the channel, isn't this a bug?

We saw the same behavior with other module, so the problem is with something else: z3ntu/lpac-libqmi-wrapper#1 (comment)

@stich86 how did you solve it?

(Thanks for the Wireshark link, I was going to try it)

as I've said only tested on two modules, commands are the same.. but never tested on Fibocom, so I cannot help
Just check a dump to see if the open-channel is using different APDU, but it's very strange...

@bam80
Copy link
Contributor Author

bam80 commented Jun 13, 2024

as I've said only tested on two modules, commands are the same.. but never tested on Fibocom, so I cannot help

That was my point - you tested in on other modules but still got the same problem, right?

so i'm tryting now in MBIM, "open-logical-channel" seems to work (on eSIM slot)

mbimcli -d /dev/cdc-wdm0 --ms-set-uicc-open-channel="application-id=a0000005591010ffffffff8900000100"
Succesfully retrieved open channel info:
	  status: 144
	 channel: 1
	response: 6F:76:84:10:A0:00:XXXXXX

but close gives error:

mbimcli -d /dev/cdc-wdm0 --ms-set-uicc-close-channel="channel=1"
error: operation failed: Unknown status 0x87430003

That error references to: { 0x87430003, "UICC_INVALID_LOGICAL_CHANNEL"},

Originally posted by @stich86 in z3ntu/lpac-libqmi-wrapper#1 (comment)

@stich86
So I'm asking how did you solve it for your modules?

@stich86
Copy link
Owner

stich86 commented Jun 13, 2024

as I've said only tested on two modules, commands are the same.. but never tested on Fibocom, so I cannot help

That was my point - you tested in on other modules but still got the same problem, right?

so i'm tryting now in MBIM, "open-logical-channel" seems to work (on eSIM slot)

mbimcli -d /dev/cdc-wdm0 --ms-set-uicc-open-channel="application-id=a0000005591010ffffffff8900000100"
Succesfully retrieved open channel info:
	  status: 144
	 channel: 1
	response: 6F:76:84:10:A0:00:XXXXXX

but close gives error:

mbimcli -d /dev/cdc-wdm0 --ms-set-uicc-close-channel="channel=1"
error: operation failed: Unknown status 0x87430003

That error references to: { 0x87430003, "UICC_INVALID_LOGICAL_CHANNEL"},

Originally posted by @stich86 in z3ntu/lpac-libqmi-wrapper#1 (comment)

@stich86 So I'm asking how did you solve it for your modules?

I had to use -p flag for proxy, that's why i've put it in the wrapper ;)

@bam80
Copy link
Contributor Author

bam80 commented Jun 13, 2024

@stich86
Aha, so without the -p flag (which shouldn't be needed anyway) you still have the same problem?

@stich86
Copy link
Owner

stich86 commented Jun 13, 2024

yes without -p it doesn't work

@bam80
Copy link
Contributor Author

bam80 commented Jun 13, 2024

Seems I've found the solution, reported it here:
https://gitlab.freedesktop.org/mobile-broadband/libmbim/-/issues/48#note_2451258

@stich86
Copy link
Owner

stich86 commented Jun 20, 2024

Seems I've found the solution, reported it here: https://gitlab.freedesktop.org/mobile-broadband/libmbim/-/issues/48#note_2451258

so have you tested the Fibocom with channel group?
I made a test using an external MiFi 5G router and Lenovo eSIM, on the MBIM dump over Windows seems that channel-group=1 is always used, but in this case I was able to interact with the eSIM without using it. In case we can put this command optional

@bam80
Copy link
Contributor Author

bam80 commented Jun 21, 2024

so have you tested the Fibocom with channel group?

Yes

In case we can put this command optional

I don't see the point to make it optional, just make it with group=1 always as Windows does and let it work uniformly.

@robimarko
Copy link

robimarko commented Jun 29, 2024

Seems I've found the solution, reported it here: https://gitlab.freedesktop.org/mobile-broadband/libmbim/-/issues/48#note_2451258

Well, it seems that Quectel RM520N-GL requires the same thing cause trying to open AID a0000005591010ffffffff8900000100 via QRTR_QMI, AT or MBIM will always fail but when the group was added it worked via mbimcli.

It obviously does not work via the wrapper still without modifying the open calls to include channel-group=1.
If modified it works most of the time.
I even got it to get half way through profile enrolment.

But, now its failing with 0x87430002 which is UICC_SELECT_FAILED and not 0x87430003 which was UICC_INVALID_LOGICAL_CHANNEL.
I have no idea what changed nor how to fix this.

@stich86
Copy link
Owner

stich86 commented Jul 2, 2024

i've added channel-group=1 to the wrapper

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants