diff options
Diffstat (limited to 'meta-steppeeagle')
4 files changed, 35 insertions, 35 deletions
diff --git a/meta-steppeeagle/recipes-applications/gpio-test/files/gpio-test.c b/meta-steppeeagle/recipes-applications/gpio-test/files/gpio-test.c index 38c43276..9fc646b1 100644 --- a/meta-steppeeagle/recipes-applications/gpio-test/files/gpio-test.c +++ b/meta-steppeeagle/recipes-applications/gpio-test/files/gpio-test.c @@ -109,7 +109,34 @@ void parse_cmd(const char *cmdline) { int fd; - if (strncmp(cmdline, "help", 4) == 0) + if ((cmdline == NULL) || (strncmp(cmdline, "exit", 4) == 0)) { + int i; + int ret; + char gpio[3 + 1]; + + printf("\nExiting...\n"); + + /* We need to unexport all the GPIO pins exported earlier */ + for (i = 0; i < AMD_GPIO_NUM_PINS; i++) { + if (gpio_in_use[i]) { + int fd; + + fd = open("/sys/class/gpio/unexport", O_WRONLY); + if (fd < 0) { + printf("\nPlease make sure AMD GPIO driver is loaded\n"); + exit(EXIT_FAILURE); + } + memset(gpio, '\0', (3 + 1)); + snprintf(gpio, 4, "%d", i); + + ret = write(fd, gpio, strlen(gpio)); + if (ret < 0) + perror("Error writing to /sys/class/gpio/unexport"); + } + } + + exit(EXIT_SUCCESS); + } else if (strncmp(cmdline, "help", 4) == 0) print_usage(); else if (strncmp(cmdline, "getnumgpio", 10) == 0) { int fd; @@ -517,33 +544,6 @@ out: perror("Error executing \'dmesg | grep GPIO\'"); } else if (strncmp(cmdline, "license", 7) == 0) { show_license(); - } else if (strncmp(cmdline, "exit", 4) == 0) { - int i; - int ret; - char gpio[3 + 1]; - - printf("\nExiting...\n"); - - /* We need to unexport all the GPIO pins exported earlier */ - for (i = 0; i < AMD_GPIO_NUM_PINS; i++) { - if (gpio_in_use[i]) { - int fd; - - fd = open("/sys/class/gpio/unexport", O_WRONLY); - if (fd < 0) { - printf("\nPlease make sure AMD GPIO driver is loaded\n"); - exit(EXIT_FAILURE); - } - memset(gpio, '\0', (3 + 1)); - snprintf(gpio, 4, "%d", i); - - ret = write(fd, gpio, strlen(gpio)); - if (ret < 0) - perror("Error writing to /sys/class/gpio/unexport"); - } - } - - exit(EXIT_SUCCESS); } else { printf("\nUnknown command\n"); print_usage(); diff --git a/meta-steppeeagle/recipes-applications/gpio-test/gpio-test_1.0.bb b/meta-steppeeagle/recipes-applications/gpio-test/gpio-test_1.0.bb index 246a1c97..8dec4293 100644 --- a/meta-steppeeagle/recipes-applications/gpio-test/gpio-test_1.0.bb +++ b/meta-steppeeagle/recipes-applications/gpio-test/gpio-test_1.0.bb @@ -2,7 +2,7 @@ DESCRIPTION = "Sample application for AMD GPIO driver" SECTION = "applications" LICENSE = "BSD" DEPENDS = "readline" -LIC_FILES_CHKSUM = "file://gpio-test.c;md5=cd7d02789bf5b4795b385ad4f2938469 \ +LIC_FILES_CHKSUM = "file://gpio-test.c;md5=c07e1063c9d11d0bafd9efb931ad6119 \ file://gpio-test.h;md5=c7aaa743b172cf584032f9bfc5e85044 \ " diff --git a/meta-steppeeagle/recipes-applications/spi-test/files/spirom-test.c b/meta-steppeeagle/recipes-applications/spi-test/files/spirom-test.c index 9006c130..091ced1a 100644 --- a/meta-steppeeagle/recipes-applications/spi-test/files/spirom-test.c +++ b/meta-steppeeagle/recipes-applications/spi-test/files/spirom-test.c @@ -125,7 +125,11 @@ void parse_cmd(const char *cmdline) int addr; int ret; - if (strncmp(cmdline, "enumerate", 9) == 0) { + if ((cmdline == NULL) || (strncmp(cmdline, "exit", 4) == 0)) { + printf("\nExiting...\n"); + close(fd); + exit(EXIT_SUCCESS); + } else if (strncmp(cmdline, "enumerate", 9) == 0) { DIR *dir; struct dirent *dir_entry; int device_found = 0; @@ -758,10 +762,6 @@ void parse_cmd(const char *cmdline) close(infile_fd); } else if (strncmp(cmdline, "license", 7) == 0) { show_license(); - } else if (strncmp(cmdline, "exit", 4) == 0) { - printf("\nExiting...\n"); - close(fd); - exit(EXIT_SUCCESS); } else if (strncmp(cmdline, "help", 4) == 0) { print_usage(); } else { diff --git a/meta-steppeeagle/recipes-applications/spi-test/spi-test_1.0.bb b/meta-steppeeagle/recipes-applications/spi-test/spi-test_1.0.bb index b374d9f8..de404758 100644 --- a/meta-steppeeagle/recipes-applications/spi-test/spi-test_1.0.bb +++ b/meta-steppeeagle/recipes-applications/spi-test/spi-test_1.0.bb @@ -2,7 +2,7 @@ DESCRIPTION = "Sample application for AMD SPI driver" SECTION = "applications" LICENSE = "BSD" DEPENDS = "readline" -LIC_FILES_CHKSUM = "file://spirom-test.c;md5=3065341fac5fc1255711c219f00f7324 \ +LIC_FILES_CHKSUM = "file://spirom-test.c;md5=57b0b983cd8e62737e6ee55f5528a421 \ file://spirom.h;md5=8de0c535224dbd8ecd2f40ef29c15d0a \ " |