From 1c7d6584a7811b7785ae5c1e378f14b5ba0971cf Mon Sep 17 00:00:00 2001 From: takeshi_hoshina Date: Mon, 2 Nov 2020 11:07:33 +0900 Subject: basesystem-jj recipes --- .../Add-additional-options-to-sample-apps.patch | 77 ++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 external/meta-iot-cloud/recipes-ibm/ibm-iotf-embeddedc/files/Add-additional-options-to-sample-apps.patch (limited to 'external/meta-iot-cloud/recipes-ibm/ibm-iotf-embeddedc/files/Add-additional-options-to-sample-apps.patch') diff --git a/external/meta-iot-cloud/recipes-ibm/ibm-iotf-embeddedc/files/Add-additional-options-to-sample-apps.patch b/external/meta-iot-cloud/recipes-ibm/ibm-iotf-embeddedc/files/Add-additional-options-to-sample-apps.patch new file mode 100644 index 00000000..de0522bf --- /dev/null +++ b/external/meta-iot-cloud/recipes-ibm/ibm-iotf-embeddedc/files/Add-additional-options-to-sample-apps.patch @@ -0,0 +1,77 @@ +From 796c934b3294871cb8ccb566ff6a9ae78d3ea4df Mon Sep 17 00:00:00 2001 +From: Vivek Chandra +Date: Wed, 21 Mar 2018 19:45:48 +0530 +Subject: [PATCH] Add additional options to sample apps + +--- + samples/sampleDevice.c | 15 +++++++++------ + samples/sampleGateway.c | 14 ++++++++++---- + 2 files changed, 19 insertions(+), 10 deletions(-) + +diff --git a/samples/sampleDevice.c b/samples/sampleDevice.c +index e1d78ea..5af14a2 100644 +--- a/samples/sampleDevice.c ++++ b/samples/sampleDevice.c +@@ -40,7 +40,6 @@ int main(int argc, char const *argv[]) + int rc = -1; + + iotfclient client; +- + //catch interrupt signal + signal(SIGINT, sigHandler); + signal(SIGTERM, sigHandler); +@@ -48,16 +47,20 @@ int main(int argc, char const *argv[]) + char* configFilePath; + + if(isEMBDCHomeDefined()){ +- + getSamplesPath(&configFilePath); + configFilePath = realloc(configFilePath,strlen(configFilePath)+15); + strcat(configFilePath,"device.cfg"); + } +- else{ +- printf("IOT_EMBDC_HOME is not defined\n"); +- printf("Define IOT_EMBDC_HOME to client library path to execute samples\n"); ++ //to handle if EMBDCHome not defined ++ else if(argc > 1) { ++ configFilePath = (char*)malloc(sizeof(char)*(strlen(argv[1])+3)); ++ strcpy(configFilePath,argv[1]); ++ } ++ else { ++ printf("Pass the absolute path of the config file as command line argument ex: ./sampleDevice / or "); ++ printf("Please define IOT_EMBDC_HOME\n"); + return -1; +- } ++ } + + rc = initialize_configfile(&client, configFilePath,0); + free(configFilePath); +diff --git a/samples/sampleGateway.c b/samples/sampleGateway.c +index 0d98f53..202ad45 100644 +--- a/samples/sampleGateway.c ++++ b/samples/sampleGateway.c +@@ -55,11 +55,17 @@ int main(int argc, char const *argv[]) + configFilePath = realloc(configFilePath,strlen(configFilePath)+15); + strcat(configFilePath,"gateway.cfg"); + } +- else{ +- printf("IOT_EMBDC_HOME is not defined\n"); +- printf("Define IOT_EMBDC_HOME to client library path to execute samples\n"); ++ //to handle if EMBDCHome not defined ++ else if(argc > 1) { ++ configFilePath = (char*)malloc(sizeof(char)*(strlen(argv[1])+3)); ++ strcpy(configFilePath,argv[1]); ++ } ++ else { ++ printf("Pass the absolute path of the config file as command line argument ex: ./sampleGateway / or "); ++ printf("Define IOT_EMBDC_HOME to client library path to execute samples\n"); + return -1; +- } ++ } ++ + + rc = initialize_configfile(&client, configFilePath,1); + free(configFilePath); +-- +2.7.4 + -- cgit 1.2.3-korg