How to install app with Legato update API?

Hello I am trying to install helloworld app on my wp76 module with Legato update API but with no luck. This is my sample code :

COMPONENT_INIT
{
    const char* filename = "/mnt/flash/updateFiles/HelloWorld.wp76xx.update";
    int fd = open(filename, O_RDONLY);

    if (fd == -1)
    {
    	LE_INFO("Can't open file");
    }

    le_result_t result = le_update_Start(fd);

    if (result != LE_OK)
    {
    	LE_INFO("FAIL");
        exit(EXIT_FAILURE);
    }
}

When I run this code I get this output:

Dec 24 17:21:55 | avcControl[2068]/framework T=main | LE_FILENAME unixSocket_SendMsg() 441 | Sending fd 9.
Dec 24 17:21:55 | updateDaemon[803]/updateDaemon T=main | updateDaemon.c le_update_Start() 2026 | Update request accepted.
Dec 24 17:21:55 | updateDaemon[2069]/framework T=main | LE_FILENAME user_Create() 1370 | Created user 'SecurityUnpack' with uid 1002 and gid 1002.
Dec 24 17:21:55 | updateDaemon[803]/updateDaemon T=main | updateUnpack.c JsonErrorHandler() 321 | Error reading update pack (Read error flags set: POLLHUP (at line 1))
Dec 24 17:21:55 | updateDaemon[803]/updateDaemon T=main | updateDaemon.c UpdateFailed() 419 | Update failed!!

I get the same error when I SSH to the board and execute:

update /mnt/flash/updateFiles/HelloWorld.wp76xx.update

Any help is appreciated.
Thank you

Update file was not good. Solution was to build update file with mkapp in console and not in Developer Studio

1 Like