File nut-powercom.c.patch of Package nut.openSUSE_11.4_Update

--- drivers/powercom.c	2009-02-17 12:20:48.000000000 +0300
+++ drivers/powercom.c	2010-03-02 15:48:25.354735038 +0300
@@ -852,21 +852,30 @@
 	
 	/* setup flow control */
 	types[type].flowControl.setup_flow_control();
-	if (!strncmp(types[type].name, "BNT",3) || !strcmp(types[type].name, "KIN") || !strcmp(types[type].name, "IMP")){
+	if (getval("type") == NULL){
 		if (!ups_getinfo()) return;
 		if (raw_data[UPSVERSION]==0xFF){
 			types[type].name="IMP";
-			model=IMPmodels[raw_data[MODELNUMBER]/16];
 		}
 		if (raw_data[MODELNAME]==0x42){
 			if (!strcmp(types[type].name, "BNT-other"))
 				types[type].name="BNT-other";
 			else
 				types[type].name="BNT";
-			model=BNTmodels[raw_data[MODELNUMBER]/16];
 		}
 		if (raw_data[MODELNAME]==0x4B){
 			types[type].name="KIN";
+		}
+	}
+	if (!strncmp(types[type].name, "BNT",3) || !strcmp(types[type].name, "KIN") || !strcmp(types[type].name, "IMP")){
+		if (!ups_getinfo()) return;
+		if (!strcmp(types[type].name, "IMP")){
+			model=IMPmodels[raw_data[MODELNUMBER]/16];
+		}
+		if (!strncmp(types[type].name, "BNT",3)){
+			model=BNTmodels[raw_data[MODELNUMBER]/16];
+		}
+		if (!strcmp(types[type].name, "KIN")){
 			model=KINmodels[raw_data[MODELNUMBER]/16];
 		}
 		linevoltage=voltages[raw_data[MODELNUMBER]%16];
openSUSE Build Service is sponsored by