Ticket #5421: myth-lcdfix-trunk.patch
File myth-lcdfix-trunk.patch, 3.7 KB (added by , 16 years ago) |
---|
-
libs/libmyth/lcddevice.cpp
227 227 228 228 last_command = someText; 229 229 230 if ( bConnected)230 if (lcd_ready) 231 231 { 232 232 #if LCD_DEVICE_DEBUG > 9 233 233 VERBOSE(VB_IMPORTANT, "lcddevice: Sending to Server: " << someText); … … 277 277 278 278 socket->readBlock(data.data(), dataSize); 279 279 280 lineFromServer = data; 281 lineFromServer = lineFromServer.replace( QRegExp("\n"), " " ); 282 lineFromServer = lineFromServer.replace( QRegExp("\r"), " " ); 283 lineFromServer.simplifyWhiteSpace(); 280 QStringList responseList = QStringList::split( QRegExp("\r|\n"), data); 284 281 282 for(uint resp = 0; resp < responseList.count(); resp++) { 283 284 lineFromServer = responseList[resp]; 285 lineFromServer.simplifyWhiteSpace(); 286 285 287 #if LCD_DEVICE_DEBUG > 4 286 // Make debugging be less noisy287 if (lineFromServer != "OK")288 VERBOSE(VB_IMPORTANT, "lcddevice: Received from server: " << lineFromServer);288 // Make debugging be less noisy 289 if (lineFromServer != "OK") 290 VERBOSE(VB_IMPORTANT, "lcddevice: Received from server: " << lineFromServer); 289 291 #endif 290 292 291 aList = QStringList::split(" ", lineFromServer); 292 if (aList[0] == "CONNECTED") 293 { 294 // We got "CONNECTED", which is a response to "HELLO" 295 lcd_ready = true; 293 aList = QStringList::split(" ", lineFromServer); 294 if (aList[0] == "CONNECTED") 295 { 296 // We got "CONNECTED", which is a response to "HELLO" 296 297 297 // get lcd width & height 298 if (aList.count() != 3) 299 { 300 VERBOSE(VB_IMPORTANT, "lcddevice: received bad no. of arguments " 298 //done by init() 299 //lcd_ready = true; 300 301 // get lcd width & height 302 if (aList.count() != 3) 303 { 304 VERBOSE(VB_IMPORTANT, "lcddevice: received bad no. of arguments " 301 305 "in CONNECTED response from LCDServer"); 302 }306 } 303 307 304 bool bOK;305 lcd_width = aList[1].toInt(&bOK);306 if (!bOK)307 {308 VERBOSE(VB_IMPORTANT, "lcddevice: received bad int for width"308 bool bOK; 309 lcd_width = aList[1].toInt(&bOK); 310 if (!bOK) 311 { 312 VERBOSE(VB_IMPORTANT, "lcddevice: received bad int for width" 309 313 "in CONNECTED response from LCDServer"); 310 }314 } 311 315 312 lcd_height = aList[2].toInt(&bOK);313 if (!bOK)314 {315 VERBOSE(VB_IMPORTANT, "lcddevice: received bad int for height"316 lcd_height = aList[2].toInt(&bOK); 317 if (!bOK) 318 { 319 VERBOSE(VB_IMPORTANT, "lcddevice: received bad int for height" 316 320 "in CONNECTED response from LCDServer"); 321 } 322 323 init(); 317 324 } 318 319 init(); 320 } 321 else if (aList[0] == "HUH?") 322 { 323 VERBOSE(VB_IMPORTANT, "lcddevice: WARNING: Something is getting passed" 325 else if (aList[0] == "HUH?") 326 { 327 VERBOSE(VB_IMPORTANT, "lcddevice: WARNING: Something is getting passed" 324 328 "to LCDServer that it doesn't understand"); 325 VERBOSE(VB_IMPORTANT, QString("lcddevice: last command: %1").arg( last_command )); 329 VERBOSE(VB_IMPORTANT, QString("lcddevice: last command: %1").arg( last_command )); 330 } 331 else if (aList[0] == "KEY") 332 handleKeyPress(aList.last().stripWhiteSpace()); 326 333 } 327 else if (aList[0] == "KEY")328 handleKeyPress(aList.last().stripWhiteSpace());329 334 } 330 335 331 336 void LCD::handleKeyPress(QString key_pressed)