From e185d974baf369399ffdbe8835e38f411951d1f9 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Mon, 15 Oct 2012 16:18:47 +0100 Subject: [PATCH] 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] --- comedi_board_info/comedi_board_info.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) 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); } } -- 2.26.2