Use legato API to open ttyUSB0 and got error

did you run the sample modemdemo application to verify?

Hi @jyijyi ,

No I didn’t do that because I think it’s too complicated.

Then maybe you should try that

Hi @jyijyi ,

I try to use modemDemo, I update app to device and I don’t know how to use.

I didn’t insert sim card.

you can see here:

Hi @jyijyi ,

I think it can work.

I saw result like below:

So I want to find what problem in my APP.

Do you have some hint for this?

Again as before, for debugging, the easiest way is you port your app to the working one and see which line makes the problem.

Hi @jyijyi ,

I try to modify helloWorld to test

my .adef

sandboxed: false
start: manual

executables:
{
Larrytest = ( larryComponent )
}

processes:
{
envVars:
{
LE_LOG_LEVEL = DEBUG
}

run:
{
    ( Larrytest )
}

}

my .cdef

sources:

{
larrytest.c
}

and my .c

#include “legato.h”

COMPONENT_INIT
{
LE_INFO(“Num of arg %d”, le_arg_NumArgs());
}

Then I got result

Aug 2 07:01:23 fx30 user.warn Legato: -WRN- | supervisor[835]/supervisor T=main | proc.c GetWatchdogAction() 359 | larrytest watchdogAction ‘’ in proc section
Aug 2 07:01:23 fx30 user.info Legato: INFO | supervisor[835]/supervisor T=main | resourceLimits.c SetRLimitValue() 282 | Setting resource limit maxCoreDumpFileBytes to value 8192.
Aug 2 07:01:23 fx30 user.info Legato: INFO | supervisor[835]/supervisor T=main | resourceLimits.c SetRLimitValue() 282 | Setting resource limit maxFileBytes to value 90112.
Aug 2 07:01:23 fx30 user.info Legato: INFO | supervisor[835]/supervisor T=main | resourceLimits.c SetRLimitValue() 282 | Setting resource limit maxLockedMemoryBytes to value 8192.
Aug 2 07:01:23 fx30 user.info Legato: INFO | supervisor[835]/supervisor T=main | resourceLimits.c SetRLimitValue() 282 | Setting resource limit maxFileDescriptors to value 256.
Aug 2 07:01:23 fx30 user.info Legato: INFO | supervisor[835]/supervisor T=main | resourceLimits.c SetRLimitValue() 282 | Setting resource limit maxMQueueBytes to value 512.
Aug 2 07:01:23 fx30 user.info Legato: INFO | supervisor[835]/supervisor T=main | resourceLimits.c SetRLimitValue() 282 | Setting resource limit maxThreads to value 20.
Aug 2 07:01:23 fx30 user.info Legato: INFO | supervisor[835]/supervisor T=main | resourceLimits.c SetRLimitValue() 282 | Setting resource limit maxQueuedSignals to value 100.
Aug 2 07:01:23 fx30 user.info Legato: INFO | supervisor[835]/supervisor T=main | proc.c proc_Start() 1389 | Starting process ‘larrytest’ with pid 12243
Aug 2 07:01:23 fx30 user.info Legato: INFO | supervisor[12243]/supervisor T=main | proc.c proc_Start() 1354 | Execing ‘larrytest’
Aug 2 07:01:23 fx30 user.emerg Legato: EMR | supervisor[12243]/supervisor T=main | proc.c proc_Start() 1366 | Could not exec ‘larrytest’. No such file or directory.
Aug 2 07:01:23 fx30 user.info Legato: INFO | supervisor[835]/supervisor T=main | proc.c proc_SigChildHandler() 2035 | Process ‘larrytest’ (PID: 12243) has exited with exit code 1.
Aug 2 07:01:23 fx30 user.warn Legato: -WRN- | supervisor[835]/supervisor T=main | app.c app_SigChildHandler() 3480 | Process ‘larrytest’ in app ‘larrytest’ faulted: Ignored.
Aug 2 07:01:24 fx30 user.warn Legato: -WRN- | posDaemon[938]/le_pa_gnss T=unknown | pa_gnss_qmi.c PositionHandler() 1359 | Bad position indication

my command is

app runProc larrytest larrytest --exe=larrytest – 123456 122343 “test” "treas

Does there have something wrong ?

maybe you can directly use the sendComponent here which has proven to be working fine:

Hi @jyijyi ,

OK, I will try it. Thanks

I have other question about use .api

I modemDemo use le_mdc.api, so I try to it but my folder is in “/home/” not like “sample” folder.

But I put my test into sample folder then I can use “le_mdc.api”, so I want to know how can I read the api when my folder is in “/home” (I can compiled but when I run app It will fault.)

do you use the makefile to compile?

Yes, I use “Makefile” to compile. I can compile success.

Also add bindings in .adef

image

And I add api source path in .cdef

then why don’t you put in the sample folder for compilation if it is working fine?

Hi @jyijyi ,

Because I want to know how to use it properly.

Then I got the error log:

Aug 2 07:57:03 fx30 user.emerg Legato: EMR | supervisor[7078]/supervisor T=main | proc.c ConfigNonSandboxedProcess() 988 | Could not change working directory to ‘/legato/systems/current/appsWriteable/larrytest’. No such file or directory

when I create the folder then other error will show

Aug 2 08:00:22 fx30 user.err Legato: =ERR= | serviceDirectory[1241]/serviceDirectory T=main | serviceDirectory.c DispatchToServer() 713 | Client (uid 0 ‘root’, pid 7556) disagrees with server (uid 0 ‘root’, pid 1367) on protocol ID of service 'Larrytest.larryCompo
Aug 2 16:00:22 fx30 user.emerg Legato: EMR | UNKNOWN[7556]/framework T=main | messagingSession.c ReceiveSessionOpenResponse() 699 | Unexpected server response: -6 (LE_FAULT).

I have no idea…
I also put in the sample folder instead of /home to compile.
Maybe you can do the same as you found that it is working fine.

Hi @jyijyi ,

I try to compile “mdcIntegrationTest” but I got error

error: implicit declaration of function ‘le_mdc_GetDisconnectionReasonExt’ [-Werror=implicit-function-declaration]
LE_PRINT_VALUE(“%d”, le_mdc_GetDisconnectionReasonExt(profileRef, LE_MDC_PDP_IPV4));

How to I fix it?

I also try to include le_mdc_common.h and le_mdc_interface.h but I can’t find the files.

please see here to add something like “-C -Wno-error=implicit-function-declaration”:

For those files, you can search in legato.io:

Hi @jyijyi ,

I added “-C -Wno-error=implicit-function-declaration” then I got other error

_build_mdcTest/wp76xx/staging/read-only/lib/libComponent_mdcTestComp.so: undefined reference to le_mdc_GetPlatformSpecificDisconnectionCodeExt' _build_mdcTest/wp76xx/staging/read-only/lib/libComponent_mdcTestComp.so: undefined reference to le_mdc_GetDisconnectionReasonExt’

I don’t see problem to compile the application with mdcTest.adef :


mkapp -t wp76xx -o Target_Legato_Debug -w Target_Legato_Debug -i "/home/owner/legato/packages/legato.framework.19.2.0.wp76xx-201906171244/resources/legato/interfaces/atServices" -i "/home/owner/legato/packages/legato.framework.19.2.0.wp76xx-201906171244/resources/legato/interfaces/airVantage/legacy" -i "/home/owner/legato/packages/legato.framework.19.2.0.wp76xx-201906171244/resources/legato/interfaces/watchdog" -i "/home/owner/legato/packages/legato.framework.19.2.0.wp76xx-201906171244/resources/legato/interfaces/portService" -i "/home/owner/legato/packages/legato.framework.19.2.0.wp76xx-201906171244/resources/legato/interfaces/supervisor" -i "/home/owner/legato/packages/legato.framework.19.2.0.wp76xx-201906171244/resources/legato/interfaces/logDaemon" -i "/home/owner/legato/packages/legato.framework.19.2.0.wp76xx-201906171244/resources/legato/interfaces/positioning" -i "/home/owner/legato/packages/legato.framework.19.2.0.wp76xx-201906171244/resources/legato/interfaces/secureStorage" -i "/home/owner/legato/packages/legato.framework.19.2.0.wp76xx-201906171244/resources/legato/interfaces" -i "/home/owner/legato/packages/legato.framework.19.2.0.wp76xx-201906171244/resources/legato/interfaces/wifi" -i "/home/owner/legato/packages/legato.framework.19.2.0.wp76xx-201906171244/resources/legato/interfaces/modemServices" -i "/home/owner/legato/packages/legato.framework.19.2.0.wp76xx-201906171244/resources/legato/interfaces/airVantage" -s "/home/owner/legato/packages/legato.framework.19.2.0.wp76xx-201906171244/resources/legato/components/dataConnectionService/platformAdaptor/default" -s "/home/owner/legato/packages/legato.framework.19.2.0.wp76xx-201906171244/resources/legato/components/test/watchdogChain" -s "/home/owner/legato/packages/legato.framework.19.2.0.wp76xx-201906171244/resources/legato/apps/platformServices/airVantageConnector" -s "/home/owner/legato/packages/legato.framework.19.2.0.wp76xx-201906171244/resources/legato/components/airVantage" -s "/home/owner/legato/packages/legato.framework.19.2.0.wp76xx-201906171244/resources/legato/modules/WiFi/apps/tools/wifi" -s "/home/owner/legato/packages/legato.framework.19.2.0.wp76xx-201906171244/resources/legato/components/positioning" -s "/home/owner/legato/packages/legato.framework.19.2.0.wp76xx-201906171244/resources/legato/components/secStore" -s "/home/owner/legato/packages/legato.framework.19.2.0.wp76xx-201906171244/resources/legato/components/uartMode/platformAdaptor/default" -s "/home/owner/legato/packages/legato.framework.19.2.0.wp76xx-201906171244/resources/legato/components/portService" -s "/home/owner/legato/packages/legato.framework.19.2.0.wp76xx-201906171244/resources/legato/components/modemServices/platformAdaptor/default" -s "/home/owner/legato/packages/legato.framework.19.2.0.wp76xx-201906171244/resources/legato/components/audio/platformAdaptor/default" -s "/home/owner/legato/packages/legato.framework.19.2.0.wp76xx-201906171244/resources/legato/apps/tools" -s "/home/owner/legato/packages/legato.framework.19.2.0.wp76xx-201906171244/resources/legato/components/3rdParty" -s "/home/owner/legato/packages/legato.framework.19.2.0.wp76xx-201906171244/resources/legato/components/fwupdate/platformAdaptor/default" -s "/home/owner/legato/packages/legato.framework.19.2.0.wp76xx-201906171244/resources/legato/components/dataConnectionService" -s "/home/owner/legato/packages/legato.framework.19.2.0.wp76xx-201906171244/resources/legato/modules/WiFi/service" -s "/home/owner/legato/packages/legato.framework.19.2.0.wp76xx-201906171244/resources/legato/components/airVantage/platformAdaptor/default" -s "/home/owner/legato/packages/legato.framework.19.2.0.wp76xx-201906171244/resources/legato/components/fwupdate" -s "/home/owner/legato/packages/legato.framework.19.2.0.wp76xx-201906171244/resources/legato/components/positioning/platformAdaptor/default" -s "/home/owner/legato/packages/legato.framework.19.2.0.wp76xx-201906171244/resources/legato/components/devMode" -s "/home/owner/legato/packages/legato.framework.19.2.0.wp76xx-201906171244/resources/legato/components/secStore/platformAdaptor/default" -s "/home/owner/legato/packages/legato.framework.19.2.0.wp76xx-201906171244/resources/legato/apps/platformServices/mqttClient" -s "." -s "/home/owner/legato/packages/legato.framework.19.2.0.wp76xx-201906171244/resources/legato/components/atServices" -s "/home/owner/legato/packages/legato.framework.19.2.0.wp76xx-201906171244/resources/legato/components/modemServices" -s "/home/owner/legato/packages/legato.framework.19.2.0.wp76xx-201906171244/resources/legato/components" -s "/home/owner/legato/packages/legato.framework.19.2.0.wp76xx-201906171244/resources/legato/components/uartMode" -C -g -X -g -L -g mdcTest.adef
[1/11] Compiling C source
[2/11] Compiling C source
[3/11] Generating IPC interface code
[4/11] Compiling C source
[5/11] Compiling C source
[6/11] Linking C library
[7/11] Bundling file
[8/11] Linking C executable
[9/11] Bundling file
[10/11] Creating info.properties
[11/11] Packaging app

Hi @jyijyi ,

I use “mkapp -v -t $@ -C -Wno-error=implicit-function-declaration
-i $(LEGATO_ROOT)/interfaces/modemServices
mdcTest.adef”

So what path must be include?