Use legato API to open ttyUSB0 and got error

i think you need to compare the OK log in cm tool and your log

Hi @jyijyi ,

How do I do this ? Where can I get cm tool log ?

I only got the log:

Aug  5 02:04:40 fx30 user.info Legato:  INFO | cm[21296]/cm T=main | cm_data.c cm_data_ProcessDataCommand() 1164 | dataParam is NULL
Aug  5 02:04:40 fx30 user.err Legato: =ERR= | modemDaemon[931]/modemDaemon T=main | le_sms.c CloseSessionEventHandler() 2311 | SessionRef (0x7f61ba8c) has been closed
Aug  5 02:04:40 fx30 daemon.warn dnsmasq[1455]: no servers found in /etc/resolv.conf, will retry
Aug  5 02:04:40 fx30 user.err Legato: =ERR= | modemDaemon[931]/modemDaemon T=main | le_sms.c CloseSessionEventHandler() 2311 | SessionRef (0x7f61c074) has been closed
Aug  5 02:06:44 fx30 user.warn Legato: -WRN- | posDaemon[944]/le_pa_gnss T=unknown | pa_gnss_qmi.c PositionHandler() 1359 | Bad position indication

let’s make another approach with modemDemo.
Please try this modemDemo application and see if it can bring the module data establishment.

app runProc modemDemo send --exe=send -- 1234567 "Online"

If it works, you can directly copy the code to your application.

Hi @jyijyi ,

I don’t understand what you mean.

The LOG described above is generated when I execute cm.

You mean that I need execute the command when I execute my APP?

BTW my device doesn’t have modemDemo app.

I mean using modemdemo app instead of cm tool

Hi @jyijyi ,

Should I update modemDemo to my device ?

I don’t know what is inside your module

Hi @jyijyi ,

My FX30 with WP76XX

then can the modemdemo work to make it establish data connection?

Hi @jyijyi

There has no modemDemo in my device.
so I should compile by myself then update it ?

yes, you need to compile it and run it

BTW, didn’t you already download to it before?

I reset my device, so I think it removed.

Hi @jyijyi ,

the command is worked, so how can I use it port the modemDemo to my APP ?

you need to understand the modemDemo program flow and copy the related to code to your application.

Hi @jyijyi ,

OK, I will try it, Maybe I will have problem then I will ask you again. Thanks for your help.

Hi @jyijyi ,

I try to use modemDemo method to create connection.

So my workflow is like below:

  1. le_mdc_SetPDP(profileRef, LE_MDC_PDP_IPV4)
  2. le_mdc_SetAPN(profileRef, “internet”)
  3. le_mdc_StartSession(profileRef)
  4. le_data_Request()
  5. set gateway and dns
  6. test connection.

I found connection will stop when app is stopped.

BTW, my app will stop by “exit(EXIT_SUCCESS)”

My question is that the connection will stop when app is stopped?

If you don’t add exit(), is it ok?
Maybe you can keep the app running

Hi @jyijyi

Yes, if I don’t add exit then the connection will keep.

It means my app should be running ?

I saw the modemdemo keeps running

Hi @jyijyi ,

OK I understood, Thanks for your help.