summaryrefslogtreecommitdiff
path: root/rbutil/rbutilqt/base/system.cpp
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2013-11-03 11:08:18 +0100
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2013-11-04 23:32:52 +0100
commit4d2ce949b3b41f8bf0af446fa20205ddd229e579 (patch)
tree01fa19471d9831b296bea5d7049f765e38b30bbb /rbutil/rbutilqt/base/system.cpp
parent335ec75d60bba82f23fc47b20f9390e0cba9c9c5 (diff)
downloadrockbox-4d2ce949b3b41f8bf0af446fa20205ddd229e579.tar.gz
rockbox-4d2ce949b3b41f8bf0af446fa20205ddd229e579.zip
Use cutelogger for Rockbox Utility internal trace.
Change tracing from qDebug() to use cutelogger, which is available under the LGPL2.1. This allows to automatically add filename and line number to the log, and also provides multiple log levels. Change-Id: I5dbdaf902ba54ea99f07ae10a07467c52fdac910
Diffstat (limited to 'rbutil/rbutilqt/base/system.cpp')
-rw-r--r--rbutil/rbutilqt/base/system.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/rbutil/rbutilqt/base/system.cpp b/rbutil/rbutilqt/base/system.cpp
index fd3b04e338..117e5dc9b4 100644
--- a/rbutil/rbutilqt/base/system.cpp
+++ b/rbutil/rbutilqt/base/system.cpp
@@ -69,6 +69,7 @@
69 69
70#include "utils.h" 70#include "utils.h"
71#include "rbsettings.h" 71#include "rbsettings.h"
72#include "Logger.h"
72 73
73/** @brief detect permission of user (only Windows at moment). 74/** @brief detect permission of user (only Windows at moment).
74 * @return enum userlevel. 75 * @return enum userlevel.
@@ -242,17 +243,17 @@ QMap<uint32_t, QString> System::listUsbDevices(void)
242{ 243{
243 QMap<uint32_t, QString> usbids; 244 QMap<uint32_t, QString> usbids;
244 // usb pid detection 245 // usb pid detection
245 qDebug() << "[System] Searching for USB devices"; 246 LOG_INFO() << "Searching for USB devices";
246#if defined(Q_OS_LINUX) 247#if defined(Q_OS_LINUX)
247#if defined(LIBUSB1) 248#if defined(LIBUSB1)
248 libusb_device **devs; 249 libusb_device **devs;
249 if(libusb_init(NULL) != 0) { 250 if(libusb_init(NULL) != 0) {
250 qDebug() << "[System] Initializing libusb-1 failed."; 251 LOG_ERROR() << "Initializing libusb-1 failed.";
251 return usbids; 252 return usbids;
252 } 253 }
253 254
254 if(libusb_get_device_list(NULL, &devs) < 1) { 255 if(libusb_get_device_list(NULL, &devs) < 1) {
255 qDebug() << "[System] Error getting device list."; 256 LOG_ERROR() << "Error getting device list.";
256 return usbids; 257 return usbids;
257 } 258 }
258 libusb_device *dev; 259 libusb_device *dev;
@@ -277,7 +278,7 @@ QMap<uint32_t, QString> System::listUsbDevices(void)
277 name = tr("(no description available)"); 278 name = tr("(no description available)");
278 if(id) { 279 if(id) {
279 usbids.insertMulti(id, name); 280 usbids.insertMulti(id, name);
280 qDebug("[System] USB: 0x%08x, %s", id, name.toLocal8Bit().data()); 281 LOG_INFO("USB: 0x%08x, %s", id, name.toLocal8Bit().data());
281 } 282 }
282 } 283 }
283 } 284 }
@@ -323,7 +324,7 @@ QMap<uint32_t, QString> System::listUsbDevices(void)
323 324
324 if(id) { 325 if(id) {
325 usbids.insertMulti(id, name); 326 usbids.insertMulti(id, name);
326 qDebug() << "[System] USB:" << QString("0x%1").arg(id, 8, 16) << name; 327 LOG_INFO() << "USB:" << QString("0x%1").arg(id, 8, 16) << name;
327 } 328 }
328 u = u->next; 329 u = u->next;
329 } 330 }
@@ -341,7 +342,7 @@ QMap<uint32_t, QString> System::listUsbDevices(void)
341 result = IOServiceGetMatchingServices(kIOMasterPortDefault, usb_matching_dictionary, 342 result = IOServiceGetMatchingServices(kIOMasterPortDefault, usb_matching_dictionary,
342 &usb_iterator); 343 &usb_iterator);
343 if(result) { 344 if(result) {
344 qDebug() << "[System] USB: IOKit: Could not get matching services."; 345 LOG_ERROR() << "USB: IOKit: Could not get matching services.";
345 return usbids; 346 return usbids;
346 } 347 }
347 348
@@ -404,7 +405,7 @@ QMap<uint32_t, QString> System::listUsbDevices(void)
404 405
405 if(id) { 406 if(id) {
406 usbids.insertMulti(id, name); 407 usbids.insertMulti(id, name);
407 qDebug() << "[System] USB:" << QString("0x%1").arg(id, 8, 16) << name; 408 LOG_INFO() << "USB:" << QString("0x%1").arg(id, 8, 16) << name;
408 } 409 }
409 410
410 } 411 }
@@ -468,7 +469,7 @@ QMap<uint32_t, QString> System::listUsbDevices(void)
468 uint32_t id; 469 uint32_t id;
469 id = vid << 16 | pid; 470 id = vid << 16 | pid;
470 usbids.insert(id, description); 471 usbids.insert(id, description);
471 qDebug("[System] USB VID: %04x, PID: %04x", vid, pid); 472 LOG_INFO("USB VID: %04x, PID: %04x", vid, pid);
472 } 473 }
473 if(buffer) free(buffer); 474 if(buffer) free(buffer);
474 } 475 }
@@ -507,7 +508,7 @@ QUrl System::systemProxy(void)
507 508
508 RegCloseKey(hk); 509 RegCloseKey(hk);
509 510
510 //qDebug() << QString::fromWCharArray(proxyval) << QString("%1").arg(enable); 511 //LOG_INFO() << QString::fromWCharArray(proxyval) << QString("%1").arg(enable);
511 if(enable != 0) 512 if(enable != 0)
512 return QUrl("http://" + QString::fromWCharArray(proxyval)); 513 return QUrl("http://" + QString::fromWCharArray(proxyval));
513 else 514 else
@@ -537,7 +538,7 @@ QUrl System::systemProxy(void)
537 bufsize = CFStringGetLength(stringref) * 2 + 1; 538 bufsize = CFStringGetLength(stringref) * 2 + 1;
538 buf = (char*)malloc(sizeof(char) * bufsize); 539 buf = (char*)malloc(sizeof(char) * bufsize);
539 if(buf == NULL) { 540 if(buf == NULL) {
540 qDebug() << "[System] can't allocate memory for proxy string!"; 541 LOG_ERROR() << "can't allocate memory for proxy string!";
541 CFRelease(dictref); 542 CFRelease(dictref);
542 return QUrl(""); 543 return QUrl("");
543 } 544 }