# How to Get IMEI Info

**URL:** <https://mangoh.discourse.group/t/how-to-get-imei-info/8897>\
**Category:** mangOH Green\
**Created:** [April 17, 2021, 10:04am UTC](https://mangoh.discourse.group/t/how-to-get-imei-info/8897 "2021-04-17T10:04:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![yoheifujimitsu](https://avatars.discourse-cdn.com/v4/letter/y/7feea3/32.png) [@yoheifujimitsu](https://mangoh.discourse.group/u/yoheifujimitsu)\
**Post date:** [April 17, 2021, 10:04am UTC](https://mangoh.discourse.group/t/how-to-get-imei-info/8897/1 "2021-04-17T10:04:52Z")

</div>

Hi.  
I would like to get IMEI number.  
So, I write bellow code and try to compile.

> #include “legato.h”  
> #include “le\_info\_common.h”
> 
> char buffer[100];  
> size\_t size=100;  
> memset(buffer, 0x00, sizeof(buffer));  
> le\_info\_GetImei(buffer, size);
> 
> LE\_INFO(“IMEI=%s(%d)”, buffer, size);

But, It finished by error.

> (lsh:wp76stable) mangoh@mangoh-dev:~/myWorkspace/shell\_test$ mkapp -t wp76xx shell\_test.adef  
> [1/7] Compiling C source  
> FAILED: /home/mangoh/myWorkspace/shell\_test/\_build\_shell\_test/wp76xx/component/e2fcc2960afd14c7be809af2bac82ab0/obj/594d2fc19aba5ba97a8c49076d99404f.o  
> /home/mangoh/myWorkspace/leaf-data/wp76stable/wp76-toolchain/sysroots/x86\_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc --sysroot=/home/mangoh/myWorkspace/leaf-data/wp76stable/wp76-toolchain/sysroots/armv7a-neon-poky-linux-gnueabi -MMD -MF /home/mangoh/myWorkspace/shell\_test/\_build\_shell\_test/wp76xx/component/e2fcc2960afd14c7be809af2bac82ab0/obj/594d2fc19aba5ba97a8c49076d99404f.o.d -c /home/mangoh/myWorkspace/shell\_test/shellTestComponent/shell\_test.c -o /home/mangoh/myWorkspace/shell\_test/\_build\_shell\_test/wp76xx/component/e2fcc2960afd14c7be809af2bac82ab0/obj/594d2fc19aba5ba97a8c49076d99404f.o -DLE\_FILENAME=`basename /home/mangoh/myWorkspace/shell_test/shellTestComponent/shell_test.c` -Wall -fPIC -Werror -fvisibility=hidden -DMK\_TOOLS\_BUILD -DLEGATO\_EMBEDDED -I /home/mangoh/myWorkspace/shell\_test/\_build\_shell\_test/wp76xx -I/home/mangoh/myWorkspace/leaf-data/wp76stable/wp76-legato/interfaces -I/home/mangoh/myWorkspace/leaf-data/wp76stable/wp76-legato/framework/include -I/home/mangoh/myWorkspace/leaf-data/wp76stable/wp76-legato/build/wp76xx/framework/include -I/home/mangoh/myWorkspace/shell\_test -I/home/mangoh/myWorkspace/shell\_test/\_build\_shell\_test/wp76xx/component/e2fcc2960afd14c7be809af2bac82ab0/src -DLE\_COMPONENT\_NAME=shellTestComponent -DLE\_LOG\_SESSION=shellTestComponent\_LogSession -DLE\_LOG\_LEVEL\_FILTER\_PTR=shellTestComponent\_LogLevelFilterPtr “-DCOMPONENT\_INIT=LE\_CI\_LINKAGE LE\_SHARED void \_shellTestComponent\_COMPONENT\_INIT()”  
> /home/mangoh/myWorkspace/shell\_test/shellTestComponent/shell\_test.c:7:10: fatal error: le\_info\_common.h: No such file or directory  
> #include “le\_info\_common.h”  
> ^ ~~~~~~~~~~~~~~~~~  
> compilation terminated.  
> ninja: build stopped: subcommand failed.

Please let me know how to resolve this error.  
Best Regards.

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/jyijyi/32/997_2.png) [@jyijyi](https://mangoh.discourse.group/u/jyijyi)\
**Post date:** [April 17, 2021, 10:26am UTC](https://mangoh.discourse.group/t/how-to-get-imei-info/8897/2 "2021-04-17T10:26:08Z")

</div>

“cm info” can get the imei

> <https://github.com/legatoproject/legato-af/blob/master/apps/tools/cm/cm_info.c>

---

<div class="post-metadata">

**Author:** ![yoheifujimitsu](https://avatars.discourse-cdn.com/v4/letter/y/7feea3/32.png) [@yoheifujimitsu](https://mangoh.discourse.group/u/yoheifujimitsu)\
**Post date:** [April 17, 2021, 10:37am UTC](https://mangoh.discourse.group/t/how-to-get-imei-info/8897/3 "2021-04-17T10:37:30Z")

</div>

Thanks for your quick reply.  
I know “cm info” can get the imei, but I can’t execute cm commands from C programs.

Pleads let me know how to execute cm commands in C programs.

Thank you.

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/jyijyi/32/997_2.png) [@jyijyi](https://mangoh.discourse.group/u/jyijyi)\
**Post date:** [April 17, 2021, 11:13am UTC](https://mangoh.discourse.group/t/how-to-get-imei-info/8897/4 "2021-04-17T11:13:36Z")

</div>

You need to use api le\_info\_GetImei()
