* [PATCH skeleton v2 0/2] Makefile changes to fix LED build failures in bitbake @ 2016-02-05 10:20 OpenBMC Patches 2016-02-05 10:20 ` [PATCH skeleton v2 1/2] " OpenBMC Patches 2016-02-05 10:20 ` [PATCH skeleton v2 2/2] " OpenBMC Patches 0 siblings, 2 replies; 4+ messages in thread From: OpenBMC Patches @ 2016-02-05 10:20 UTC (permalink / raw) To: openbmc https://github.com/openbmc/skeleton/pull/39 vishwa (2): Makefile changes to fix LED build failures in bitbake Makefile changes to fix LED build failures in bitbake Makefile | 6 ++++-- objects/led_controller_new.c | 37 +++++++++++++++---------------------- 2 files changed, 19 insertions(+), 24 deletions(-) -- 2.6.4 ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH skeleton v2 1/2] Makefile changes to fix LED build failures in bitbake 2016-02-05 10:20 [PATCH skeleton v2 0/2] Makefile changes to fix LED build failures in bitbake OpenBMC Patches @ 2016-02-05 10:20 ` OpenBMC Patches 2016-02-05 10:20 ` [PATCH skeleton v2 2/2] " OpenBMC Patches 1 sibling, 0 replies; 4+ messages in thread From: OpenBMC Patches @ 2016-02-05 10:20 UTC (permalink / raw) To: openbmc From: vishwa <vishwanath@in.ibm.com> --- Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 65787ff..e787990 100755 --- a/Makefile +++ b/Makefile @@ -6,6 +6,8 @@ OBJS2 = progress.o ast-sf-ctrl.o libflash.o libffs.o arm_io.o OBJS3 = obj/progress.o obj/ast-sf-ctrl.o obj/libflash.o obj/libffs.o obj/arm_io.o INCLUDES=$(shell pkg-config --cflags gio-unix-2.0 glib-2.0) -Iincludes -Iobjects/pflash -I. LIBS=$(shell pkg-config --libs gio-unix-2.0 glib-2.0) -Llib -lopenbmc_intf +INC_FLAG += $(shell pkg-config --cflags --libs libsystemd) -I. -O2 +LIB_FLAG += $(shell pkg-config --libs libsystemd) %.o: interfaces/%.c $(CC) -c -fPIC -o obj/$@ $< $(CFLAGS) $(INCLUDES) @@ -22,7 +24,7 @@ LIBS=$(shell pkg-config --libs gio-unix-2.0 glib-2.0) -Llib -lopenbmc_intf %.o: objects/pflash/libflash/%.c $(CC) -c -o obj/$@ $< $(CFLAGS) $(INCLUDES) -all: setup libopenbmc_intf power_control led_controller button_power button_reset control_host host_watchdog board_vpd pcie_slot_present flash_bios flasher pflash hwmons_barreleye control_bmc +all: setup libopenbmc_intf power_control led_controller button_power button_reset control_host host_watchdog board_vpd pcie_slot_present flash_bios flasher pflash hwmons_barreleye control_bmc led_controller_new setup: mkdir -p obj lib @@ -40,7 +42,7 @@ led_controller: led_controller.o gpio.o object_mapper.o libopenbmc_intf $(CC) -o bin/$@.exe obj/gpio.o obj/led_controller.o obj/object_mapper.o $(LDFLAGS) $(LIBS) led_controller_new: led_controller_new.o - $(CC) -o bin/$@.exe obj/led_controller_new.o $(LDFLAGS) $(LIBS) -lsystemd + $(CC) $(INC_FLAG) -o bin/$@.exe obj/led_controller_new.o $(LDFLAGS) $(LIBS) $(LIB_FLAG) button_power: button_power_obj.o gpio.o object_mapper.o libopenbmc_intf $(CC) -o bin/$@.exe obj/button_power_obj.o obj/gpio.o obj/object_mapper.o $(LDFLAGS) $(LIBS) -- 2.6.4 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH skeleton v2 2/2] Makefile changes to fix LED build failures in bitbake 2016-02-05 10:20 [PATCH skeleton v2 0/2] Makefile changes to fix LED build failures in bitbake OpenBMC Patches 2016-02-05 10:20 ` [PATCH skeleton v2 1/2] " OpenBMC Patches @ 2016-02-05 10:20 ` OpenBMC Patches 2016-02-08 12:28 ` Daniel Axtens 1 sibling, 1 reply; 4+ messages in thread From: OpenBMC Patches @ 2016-02-05 10:20 UTC (permalink / raw) To: openbmc From: vishwa <vishwanath@in.ibm.com> --- Makefile | 4 ++-- objects/led_controller_new.c | 37 +++++++++++++++---------------------- 2 files changed, 17 insertions(+), 24 deletions(-) diff --git a/Makefile b/Makefile index e787990..1a8e88e 100755 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ OBJS2 = progress.o ast-sf-ctrl.o libflash.o libffs.o arm_io.o OBJS3 = obj/progress.o obj/ast-sf-ctrl.o obj/libflash.o obj/libffs.o obj/arm_io.o INCLUDES=$(shell pkg-config --cflags gio-unix-2.0 glib-2.0) -Iincludes -Iobjects/pflash -I. LIBS=$(shell pkg-config --libs gio-unix-2.0 glib-2.0) -Llib -lopenbmc_intf -INC_FLAG += $(shell pkg-config --cflags --libs libsystemd) -I. -O2 +INCLUDES += $(shell pkg-config --cflags --libs libsystemd) -I. -O2 LIB_FLAG += $(shell pkg-config --libs libsystemd) %.o: interfaces/%.c @@ -42,7 +42,7 @@ led_controller: led_controller.o gpio.o object_mapper.o libopenbmc_intf $(CC) -o bin/$@.exe obj/gpio.o obj/led_controller.o obj/object_mapper.o $(LDFLAGS) $(LIBS) led_controller_new: led_controller_new.o - $(CC) $(INC_FLAG) -o bin/$@.exe obj/led_controller_new.o $(LDFLAGS) $(LIBS) $(LIB_FLAG) + $(CC) -o bin/$@.exe obj/led_controller_new.o $(LDFLAGS) $(LIB_FLAG) button_power: button_power_obj.o gpio.o object_mapper.o libopenbmc_intf $(CC) -o bin/$@.exe obj/button_power_obj.o obj/gpio.o obj/object_mapper.o $(LDFLAGS) $(LIBS) diff --git a/objects/led_controller_new.c b/objects/led_controller_new.c index c8b3f92..0eac7a8 100755 --- a/objects/led_controller_new.c +++ b/objects/led_controller_new.c @@ -48,7 +48,7 @@ int write_to_led(const char *name, const char *ctrl_file, const char *value) char led_path[128] = {0}; int len = 0; - len = snprintf(led_path, sizeof(led_path), + len = snprintf(led_path, sizeof(led_path), "/sys/class/leds/%s/%s",name, ctrl_file); if(len >= sizeof(led_path)) { @@ -59,16 +59,14 @@ int write_to_led(const char *name, const char *ctrl_file, const char *value) FILE *fp = fopen(led_path,"w"); if(fp == NULL) { - perror("Error:"); - fprintf(stderr,"Error opening:[%s]\n",led_path); + fprintf(stderr,"Error:[%s] opening:[%s]\n",strerror(errno),led_path); return rc; } rc = fwrite(value, strlen(value), 1, fp); if(rc != 1) { - perror("Error:"); - fprintf(stderr, "Error writing to :[%s]\n",led_path); + fprintf(stderr, "Error:[%s] writing to :[%s]\n",strerror(errno),led_path); } fclose(fp); @@ -129,11 +127,11 @@ static int led_function_router(sd_bus_message *msg, void *user_data, char value_str[10] = {0}; const char *led_state = NULL; - rc = read_led(led_name, power_ctrl, value_str, sizeof(value_str)); + rc = read_led(led_name, power_ctrl, value_str, sizeof(value_str)-1); if(rc >= 0) { - /* LED is active low */ - led_state = strtoul(value_str, NULL, 0) ? "Off" : "On"; + /* LED is active HI */ + led_state = strtoul(value_str, NULL, 0) ? "On" : "Off"; } return sd_bus_reply_method_return(msg, "is", rc, led_state); } @@ -156,12 +154,12 @@ int led_stable_state_function(char *led_name, char *led_function) int rc = -1; const char *value = NULL; - if(strcmp(led_function, "setOn") == 0) + if(strcmp(led_function, "setOff") == 0) { - /* LED active low */ + /* LED active HI */ value = "0"; } - else if(strcmp(led_function, "setOff") == 0) + else if(strcmp(led_function, "setOn") == 0) { value = "255"; } @@ -272,11 +270,11 @@ int led_default_blink(char *led_name, char *blink_type) * Gets the current value of passed in LED file * Mainly used for reading 'brightness' * NOTE : It is the responsibility of the caller to allocate - * sufficient space for buffer. This will read upto user supplied + * sufficient space for buffer. This will read upto user supplied * size -or- entire contents of file whichever is smaller * ---------------------------------------------------------------- */ -int read_led(const char *name, const char *ctrl_file, +int read_led(const char *name, const char *ctrl_file, void *value, const size_t len) { /* Generic error reporter. */ @@ -293,7 +291,7 @@ int read_led(const char *name, const char *ctrl_file, char led_path[128] = {0}; int led_len = 0; - led_len = snprintf(led_path, sizeof(led_path), + led_len = snprintf(led_path, sizeof(led_path), "/sys/class/leds/%s/%s",name, ctrl_file); if(led_len >= sizeof(led_path)) { @@ -304,8 +302,7 @@ int read_led(const char *name, const char *ctrl_file, FILE *fp = fopen(led_path,"rb"); if(fp == NULL) { - perror("Error:"); - fprintf(stderr,"Error opening:[%s]\n",led_path); + fprintf(stderr,"Error:[%s] opening:[%s]\n",strerror(errno),led_path); return rc; } @@ -314,7 +311,6 @@ int read_led(const char *name, const char *ctrl_file, { sysfs_value[count++] = fgetc(fp); } - sysfs_value[count]='\0'; fclose(fp); return 0; @@ -378,7 +374,7 @@ int start_led_services() return rc; } - count_leds = num_leds = scandir("/sys/class/leds/", + count_leds = num_leds = scandir("/sys/class/leds/", &led_list, led_select, alphasort); if(num_leds <= 0) { @@ -427,11 +423,8 @@ int start_led_services() while (count_leds > 0) { free(led_list[--count_leds]); - if(count_leds == 0) - { - free(led_list); - } } + free(led_list); /* If we had success in adding the providers, request for a bus name. */ if(rc == 0) -- 2.6.4 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH skeleton v2 2/2] Makefile changes to fix LED build failures in bitbake 2016-02-05 10:20 ` [PATCH skeleton v2 2/2] " OpenBMC Patches @ 2016-02-08 12:28 ` Daniel Axtens 0 siblings, 0 replies; 4+ messages in thread From: Daniel Axtens @ 2016-02-08 12:28 UTC (permalink / raw) To: OpenBMC Patches, openbmc OpenBMC Patches <openbmc-patches@stwcx.xyz> writes: > From: vishwa <vishwanath@in.ibm.com> > > --- > Makefile | 4 ++-- > objects/led_controller_new.c | 37 +++++++++++++++---------------------- It seems like you're doing makefile change and whitespace changes? Would it be possible to split them into two patches please? Thanks :) Regards, Daniel > 2 files changed, 17 insertions(+), 24 deletions(-) > > diff --git a/Makefile b/Makefile > index e787990..1a8e88e 100755 > --- a/Makefile > +++ b/Makefile > @@ -6,7 +6,7 @@ OBJS2 = progress.o ast-sf-ctrl.o libflash.o libffs.o arm_io.o > OBJS3 = obj/progress.o obj/ast-sf-ctrl.o obj/libflash.o obj/libffs.o obj/arm_io.o > INCLUDES=$(shell pkg-config --cflags gio-unix-2.0 glib-2.0) -Iincludes -Iobjects/pflash -I. > LIBS=$(shell pkg-config --libs gio-unix-2.0 glib-2.0) -Llib -lopenbmc_intf > -INC_FLAG += $(shell pkg-config --cflags --libs libsystemd) -I. -O2 > +INCLUDES += $(shell pkg-config --cflags --libs libsystemd) -I. -O2 > LIB_FLAG += $(shell pkg-config --libs libsystemd) > > %.o: interfaces/%.c > @@ -42,7 +42,7 @@ led_controller: led_controller.o gpio.o object_mapper.o libopenbmc_intf > $(CC) -o bin/$@.exe obj/gpio.o obj/led_controller.o obj/object_mapper.o $(LDFLAGS) $(LIBS) > > led_controller_new: led_controller_new.o > - $(CC) $(INC_FLAG) -o bin/$@.exe obj/led_controller_new.o $(LDFLAGS) $(LIBS) $(LIB_FLAG) > + $(CC) -o bin/$@.exe obj/led_controller_new.o $(LDFLAGS) $(LIB_FLAG) > > button_power: button_power_obj.o gpio.o object_mapper.o libopenbmc_intf > $(CC) -o bin/$@.exe obj/button_power_obj.o obj/gpio.o obj/object_mapper.o $(LDFLAGS) $(LIBS) > diff --git a/objects/led_controller_new.c b/objects/led_controller_new.c > index c8b3f92..0eac7a8 100755 > --- a/objects/led_controller_new.c > +++ b/objects/led_controller_new.c > @@ -48,7 +48,7 @@ int write_to_led(const char *name, const char *ctrl_file, const char *value) > char led_path[128] = {0}; > > int len = 0; > - len = snprintf(led_path, sizeof(led_path), > + len = snprintf(led_path, sizeof(led_path), > "/sys/class/leds/%s/%s",name, ctrl_file); > if(len >= sizeof(led_path)) > { > @@ -59,16 +59,14 @@ int write_to_led(const char *name, const char *ctrl_file, const char *value) > FILE *fp = fopen(led_path,"w"); > if(fp == NULL) > { > - perror("Error:"); > - fprintf(stderr,"Error opening:[%s]\n",led_path); > + fprintf(stderr,"Error:[%s] opening:[%s]\n",strerror(errno),led_path); > return rc; > } > > rc = fwrite(value, strlen(value), 1, fp); > if(rc != 1) > { > - perror("Error:"); > - fprintf(stderr, "Error writing to :[%s]\n",led_path); > + fprintf(stderr, "Error:[%s] writing to :[%s]\n",strerror(errno),led_path); > } > > fclose(fp); > @@ -129,11 +127,11 @@ static int led_function_router(sd_bus_message *msg, void *user_data, > char value_str[10] = {0}; > const char *led_state = NULL; > > - rc = read_led(led_name, power_ctrl, value_str, sizeof(value_str)); > + rc = read_led(led_name, power_ctrl, value_str, sizeof(value_str)-1); > if(rc >= 0) > { > - /* LED is active low */ > - led_state = strtoul(value_str, NULL, 0) ? "Off" : "On"; > + /* LED is active HI */ > + led_state = strtoul(value_str, NULL, 0) ? "On" : "Off"; > } > return sd_bus_reply_method_return(msg, "is", rc, led_state); > } > @@ -156,12 +154,12 @@ int led_stable_state_function(char *led_name, char *led_function) > int rc = -1; > > const char *value = NULL; > - if(strcmp(led_function, "setOn") == 0) > + if(strcmp(led_function, "setOff") == 0) > { > - /* LED active low */ > + /* LED active HI */ > value = "0"; > } > - else if(strcmp(led_function, "setOff") == 0) > + else if(strcmp(led_function, "setOn") == 0) > { > value = "255"; > } > @@ -272,11 +270,11 @@ int led_default_blink(char *led_name, char *blink_type) > * Gets the current value of passed in LED file > * Mainly used for reading 'brightness' > * NOTE : It is the responsibility of the caller to allocate > - * sufficient space for buffer. This will read upto user supplied > + * sufficient space for buffer. This will read upto user supplied > * size -or- entire contents of file whichever is smaller > * ---------------------------------------------------------------- > */ > -int read_led(const char *name, const char *ctrl_file, > +int read_led(const char *name, const char *ctrl_file, > void *value, const size_t len) > { > /* Generic error reporter. */ > @@ -293,7 +291,7 @@ int read_led(const char *name, const char *ctrl_file, > char led_path[128] = {0}; > > int led_len = 0; > - led_len = snprintf(led_path, sizeof(led_path), > + led_len = snprintf(led_path, sizeof(led_path), > "/sys/class/leds/%s/%s",name, ctrl_file); > if(led_len >= sizeof(led_path)) > { > @@ -304,8 +302,7 @@ int read_led(const char *name, const char *ctrl_file, > FILE *fp = fopen(led_path,"rb"); > if(fp == NULL) > { > - perror("Error:"); > - fprintf(stderr,"Error opening:[%s]\n",led_path); > + fprintf(stderr,"Error:[%s] opening:[%s]\n",strerror(errno),led_path); > return rc; > } > > @@ -314,7 +311,6 @@ int read_led(const char *name, const char *ctrl_file, > { > sysfs_value[count++] = fgetc(fp); > } > - sysfs_value[count]='\0'; > > fclose(fp); > return 0; > @@ -378,7 +374,7 @@ int start_led_services() > return rc; > } > > - count_leds = num_leds = scandir("/sys/class/leds/", > + count_leds = num_leds = scandir("/sys/class/leds/", > &led_list, led_select, alphasort); > if(num_leds <= 0) > { > @@ -427,11 +423,8 @@ int start_led_services() > while (count_leds > 0) > { > free(led_list[--count_leds]); > - if(count_leds == 0) > - { > - free(led_list); > - } > } > + free(led_list); > > /* If we had success in adding the providers, request for a bus name. */ > if(rc == 0) > -- > 2.6.4 > > > _______________________________________________ > openbmc mailing list > openbmc@lists.ozlabs.org > https://lists.ozlabs.org/listinfo/openbmc ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-02-08 12:28 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-02-05 10:20 [PATCH skeleton v2 0/2] Makefile changes to fix LED build failures in bitbake OpenBMC Patches 2016-02-05 10:20 ` [PATCH skeleton v2 1/2] " OpenBMC Patches 2016-02-05 10:20 ` [PATCH skeleton v2 2/2] " OpenBMC Patches 2016-02-08 12:28 ` Daniel Axtens
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.