Uqmi returns only first SIM application even primary GW is application 2

I'm using a Quectel EP20 module to connect to a 4G network as fallback connection. This was working fine in the previous OpenWRT version (21.02 I think), but after upgrading to 23.05, the connection always returns PIN_STATUS_FAILED.

After some investigation, it seems that the uqmi utility doesn't return the correct SIM application as reported by qmicli.

With qmicli --uim-get-card-status, the returned info is as follows:

Provisioning applications:
	Primary GW:   slot '1', application '2'
	Primary 1X:   session doesn't exist
	Secondary GW: session doesn't exist
	Secondary 1X: session doesn't exist
Slot [1]:
	Card state: 'present'
	UPIN state: 'not-initialized'
		UPIN retries: '0'
		UPUK retries: '0'
	Application [1]:
		Application type:  'csim (4)'
		Application state: 'detected'
		Application ID:
			A0:00:00:03:43:10:02:FF:86:FF:03:89:FF:FF:FF:FF
		Personalization state: 'unknown'
		UPIN replaces PIN1: 'no'
		PIN1 state: 'not-initialized'
			PIN1 retries: '0'
			PUK1 retries: '0'
		PIN2 state: 'not-initialized'
			PIN2 retries: '0'
			PUK2 retries: '0'
	Application [2]:
		Application type:  'usim (2)'
		Application state: 'ready'
		Application ID:
			A0:00:00:00:87:10:02:FF:86:FF:03:89:FF:FF:FF:FF
		Personalization state: 'ready'
		UPIN replaces PIN1: 'no'
		PIN1 state: 'disabled'
			PIN1 retries: '3'
			PUK1 retries: '10'
		PIN2 state: 'enabled-not-verified'
			PIN2 retries: '3'
			PUK2 retries: '10'

As you can see the Primary GW is Slot 1 - Application 2, which has the correct configuration. But uqmi --uim-get-sim-state actually returns the Application 1 info:

{
	"card_application_state": "detected",
	"pin1_status": "not_initialized",
	"pin1_verify_tries": 0,
	"pin1_unlock_tries": 0,
	"pin2_status": "not_initialized",
	"pin2_verify_tries": 0,
	"pin2_unlock_tries": 0
}

This can be confirmed by looking at the source code for uqmi --uim-get-sim-state here: https://lxr.openwrt.org/source/uqmi/uqmi/commands-uim.c , the code shows and the comment states that the uqmi utility only returns the first "valid" application, instead of the correct one.

Is there anyway I can make it detect the correct application profile?

I doubt such a model exists. Please show the output of cat /sys/kernel/debug/usb/devices

Ahh sorry, it's EP06-E, got it confused with EC20

Then I would check if the same issue is present in MBIM mode (with umbim) and as a last resort I would switch to ECM where no helper application is used.

Thanks, MBIM mode works. Somehow it was working fine in QMI mode in older OpenWRT, I wonder what changed..