From: Ian Abbott Date: Mon, 15 Oct 2012 15:18:47 +0000 (+0100) Subject: comedi_board_info: improve display of external ranges. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=e185d974baf369399ffdbe8835e38f411951d1f9;p=comedilib.git comedi_board_info: improve display of external ranges. The units for a range with internal unit code `RF_EXTERNAL | UNIT_volt` is currently displayed as " (unknown unit 256)", for example an external bipolar voltage range -1 to 1 is displayed as: [-1 (unknown unit 256),1 (unknown unit 256)] Change it to be displayed as: [-1*EXT V,1*EXT V] --- diff --git a/comedi_board_info/comedi_board_info.c b/comedi_board_info/comedi_board_info.c index 26c5426..ef058f1 100644 --- a/comedi_board_info/comedi_board_info.c +++ b/comedi_board_info/comedi_board_info.c @@ -78,11 +78,15 @@ void explain_subdevice_flags(char* padding,unsigned int sf) { } void unit_to_desc(char *udesc,int unit) { - switch(unit) { - case UNIT_volt: strcpy(udesc," V"); break; - case UNIT_mA: strcpy(udesc," mA"); break; - case UNIT_none: strcpy(udesc,""); break; - default: sprintf(udesc," (unknown unit %d)", + if ((unit & RF_EXTERNAL) != 0) + strcpy(udesc, "*EXT"); + else + udesc[0] = '\0'; + switch(RF_UNIT(unit)) { + case UNIT_volt: strcat(udesc," V"); break; + case UNIT_mA: strcat(udesc," mA"); break; + case UNIT_none: strcat(udesc,""); break; + default: sprintf(udesc + strlen(udesc)," (unknown unit %d)", unit); } }