Package: xsensors Version: 0.70-2 Severity: important Tags: patch Dear Maintainer,
Here is the other patch I mentioned in #665504 as forthcoming. When add_sensor_tab() probes the sensor's subfeatures, if it finds one that is upsupported by xsensors, it stops probing. If any supported senors have already been set up, then these get displayed (as well as the empty tab for the unsupported sensor). If no supported sensors are setup before this choke, then all subsequent sensors are ignored and the console sees: Couldn't parse chip <name_of_chip>! Exiting! GUI failed! Attached patch just does a quick loop through the sensor's features. If a supported feature is found, it allows add_sensor_tab() to do it's thing. If not, it forces the outer loop to skip to the next sensor, if there is one. For your convience, I also attached a rolled patch that also covers #665504 and this report. Regards, John Vogel <jvog...@stny.rr.com> -- System Information: Debian Release: wheezy/sid APT prefers unstable APT policy: (500, 'unstable'), (500, 'testing') Architecture: amd64 (x86_64) Kernel: Linux 3.2.0-2-amd64 (SMP w/6 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages xsensors depends on: ii libatk1.0-0 2.2.0-2 ii libc6 2.13-27 ii libcairo2 1.10.2-7 ii libfontconfig1 2.8.0-3.1 ii libfreetype6 2.4.8-1 ii libgdk-pixbuf2.0-0 2.24.1-1 ii libglib2.0-0 2.30.2-6 ii libgtk2.0-0 2.24.10-1 ii libpango1.0-0 1.29.4-3 ii libsensors4 1:3.3.1-2 Versions of packages xsensors recommends: ii lm-sensors 1:3.3.1-2 xsensors suggests no packages.
From: John Vogel <jvog...@stny.rr.com> Subject: Check for unsupported sensor features before chip tab creation * Add feature check on current sensor before creating tab window for chip; prevents add_sensor_tab() from choking on unsupported features. --- diff -uNr a/src/gui.c b/src/gui.c --- a/src/gui.c 2012-03-24 22:10:45.046471888 -0400 +++ b/src/gui.c 2012-03-24 22:13:14.406475648 -0400 @@ -455,6 +455,26 @@ } while ( ( name = sensors_get_detected_chips( pquery, &chipnum ) ) != NULL ) { + /* This is a hack. what really needs to be done is to separate the gui code + from the chip feature parsing. Then this won't even be needed at window + creation time at all. */ + const sensors_feature *feature; + int chipnum2 = 0; + int use_chip = 0; + while ((feature = sensors_get_features (name, &chipnum2)) && (!use_chip)) { + switch (feature->type) { + case SENSORS_FEATURE_TEMP: + case SENSORS_FEATURE_IN: + case SENSORS_FEATURE_FAN: + use_chip++; + break; + default: + break; + } + } + if (!use_chip) + continue; + #ifdef DEBUG_XSENSORS printf( "Adding tab for %s\n", name->prefix ); #endif Binary files a/src/.gui.c.swp and b/src/.gui.c.swp differ
diff -uNr a/src/gui.c b/src/gui.c --- a/src/gui.c 2012-03-24 22:22:54.206490260 -0400 +++ b/src/gui.c 2012-03-24 22:24:11.918491987 -0400 @@ -455,6 +455,26 @@ } while ( ( name = sensors_get_detected_chips( pquery, &chipnum ) ) != NULL ) { + /* This is a hack. what really needs to be done is to separate the gui code + from the chip feature parsing. Then this won't even be needed at window + creation time at all. */ + const sensors_feature *feature; + int chipnum2 = 0; + int use_chip = 0; + while ((feature = sensors_get_features (name, &chipnum2)) && (!use_chip)) { + switch (feature->type) { + case SENSORS_FEATURE_TEMP: + case SENSORS_FEATURE_IN: + case SENSORS_FEATURE_FAN: + use_chip++; + break; + default: + break; + } + } + if (!use_chip) + continue; + #ifdef DEBUG_XSENSORS printf( "Adding tab for %s\n", name->prefix ); #endif @@ -547,8 +567,8 @@ gtk_container_add( GTK_CONTAINER (mainwindow), notebook ); - if ( argc >= 2 ) { - for ( i = 1; i < argc; i++ ) { + if ( argc > 0 ) { + for ( i = 0; i < argc; i++ ) { head = add_sensor_chips( notebook, argv[i] ); if ( head == NULL ) return FAILURE; diff -uNr a/src/main.c b/src/main.c --- a/src/main.c 2012-03-24 22:22:54.206490260 -0400 +++ b/src/main.c 2012-03-24 22:24:03.238491513 -0400 @@ -61,6 +61,10 @@ char *sens_config = NULL; FILE *sens_conf_file = NULL; char *temp_str = NULL; + int nargc; + char **nargv; + + gtk_parse_args (&argc, &argv); /* Process arguements. */ while ( ( c = getopt( argc, argv, "fhc:i:t:v" ) ) != EOF ) { @@ -105,6 +109,9 @@ } } + nargc = argc - optind; + nargv = (char **)argv+optind; + /* Open the config file if specified. */ if ( sens_config && ( sens_conf_file = fopen( sens_config, "r" ) ) == NULL ) { @@ -122,7 +129,7 @@ } /* This will start the GUI. */ - if ( start_gui( argc, argv ) != SUCCESS ) { + if ( start_gui( nargc, nargv ) != SUCCESS ) { fprintf( stderr, "GUI failed!\n" ); }