summaryrefslogtreecommitdiff
path: root/rbutil/rbutilqt/base/autodetection.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/autodetection.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/autodetection.cpp')
-rw-r--r--rbutil/rbutilqt/base/autodetection.cpp39
1 files changed, 20 insertions, 19 deletions
diff --git a/rbutil/rbutilqt/base/autodetection.cpp b/rbutil/rbutilqt/base/autodetection.cpp
index 4b3d1a1ab1..1253202e40 100644
--- a/rbutil/rbutilqt/base/autodetection.cpp
+++ b/rbutil/rbutilqt/base/autodetection.cpp
@@ -28,6 +28,7 @@
28#include "system.h" 28#include "system.h"
29#include "utils.h" 29#include "utils.h"
30#include "rockboxinfo.h" 30#include "rockboxinfo.h"
31#include "Logger.h"
31 32
32Autodetection::Autodetection(QObject* parent): QObject(parent) 33Autodetection::Autodetection(QObject* parent): QObject(parent)
33{ 34{
@@ -67,8 +68,8 @@ bool Autodetection::detect(void)
67 } 68 }
68 } 69 }
69 for(int i = 0; i < m_detected.size(); ++i) { 70 for(int i = 0; i < m_detected.size(); ++i) {
70 qDebug() << "[Autodetect] Detected player:" << m_detected.at(i).device 71 LOG_INFO() << "Detected player:" << m_detected.at(i).device
71 << "at" << m_detected.at(i).mountpoint << states[m_detected.at(i).status]; 72 << "at" << m_detected.at(i).mountpoint << states[m_detected.at(i).status];
72 } 73 }
73 74
74 return m_detected.size() > 0; 75 return m_detected.size() > 0;
@@ -98,14 +99,14 @@ void Autodetection::detectUsb()
98 d.status = PlayerOk; 99 d.status = PlayerOk;
99 d.usbdevices = usbids.value(attached.at(i)); 100 d.usbdevices = usbids.value(attached.at(i));
100 m_detected.append(d); 101 m_detected.append(d);
101 qDebug() << "[USB] detected supported player" << d.usbdevices; 102 LOG_INFO() << "[USB] detected supported player" << d.usbdevices;
102 } 103 }
103 if(usberror.contains(attached.at(i))) { 104 if(usberror.contains(attached.at(i))) {
104 struct Detected d; 105 struct Detected d;
105 d.status = PlayerMtpMode; 106 d.status = PlayerMtpMode;
106 d.device = usbids.value(attached.at(i)).at(0); 107 d.device = usbids.value(attached.at(i)).at(0);
107 m_detected.append(d); 108 m_detected.append(d);
108 qDebug() << "[USB] detected problem with player" << d.device; 109 LOG_WARNING() << "[USB] detected problem with player" << d.device;
109 } 110 }
110 QString idstring = QString("%1").arg(attached.at(i), 8, 16, QChar('0')); 111 QString idstring = QString("%1").arg(attached.at(i), 8, 16, QChar('0'));
111 if(!SystemInfo::platformValue(idstring, SystemInfo::CurName).toString().isEmpty()) { 112 if(!SystemInfo::platformValue(idstring, SystemInfo::CurName).toString().isEmpty()) {
@@ -113,7 +114,7 @@ void Autodetection::detectUsb()
113 d.status = PlayerIncompatible; 114 d.status = PlayerIncompatible;
114 d.device = idstring; 115 d.device = idstring;
115 m_detected.append(d); 116 m_detected.append(d);
116 qDebug() << "[USB] detected incompatible player" << d.device; 117 LOG_WARNING() << "[USB] detected incompatible player" << d.device;
117 } 118 }
118 } 119 }
119} 120}
@@ -125,7 +126,7 @@ void Autodetection::detectUsb()
125void Autodetection::mergeMounted(void) 126void Autodetection::mergeMounted(void)
126{ 127{
127 QStringList mounts = Utils::mountpoints(Utils::MountpointsSupported); 128 QStringList mounts = Utils::mountpoints(Utils::MountpointsSupported);
128 qDebug() << "[Autodetect] paths to check:" << mounts; 129 LOG_INFO() << "paths to check:" << mounts;
129 130
130 for(int i = 0; i < mounts.size(); i++) 131 for(int i = 0; i < mounts.size(); i++)
131 { 132 {
@@ -143,8 +144,8 @@ void Autodetection::mergeMounted(void)
143 d.mountpoint = mounts.at(i); 144 d.mountpoint = mounts.at(i);
144 d.status = PlayerOk; 145 d.status = PlayerOk;
145 updateDetectedDevice(d); 146 updateDetectedDevice(d);
146 qDebug() << "[Autodetect] rbutil.log detected:" 147 LOG_INFO() << "rbutil.log detected:"
147 << log.value("platform").toString() << mounts.at(i); 148 << log.value("platform").toString() << mounts.at(i);
148 } 149 }
149 } 150 }
150 151
@@ -157,8 +158,8 @@ void Autodetection::mergeMounted(void)
157 d.mountpoint = mounts.at(i); 158 d.mountpoint = mounts.at(i);
158 d.status = PlayerOk; 159 d.status = PlayerOk;
159 updateDetectedDevice(d); 160 updateDetectedDevice(d);
160 qDebug() << "[Autodetect] rockbox-info.txt detected:" 161 LOG_INFO() << "rockbox-info.txt detected:"
161 << info.target() << mounts.at(i); 162 << info.target() << mounts.at(i);
162 } 163 }
163 164
164 // check for some specific files in root folder 165 // check for some specific files in root folder
@@ -193,13 +194,13 @@ void Autodetection::mergeMounted(void)
193 } 194 }
194 if(rootentries.contains("ajbrec.ajz", Qt::CaseInsensitive)) 195 if(rootentries.contains("ajbrec.ajz", Qt::CaseInsensitive))
195 { 196 {
196 qDebug() << "[Autodetect] ajbrec.ajz found. Trying detectAjbrec()"; 197 LOG_INFO() << "ajbrec.ajz found. Trying detectAjbrec()";
197 struct Detected d; 198 struct Detected d;
198 d.device = detectAjbrec(mounts.at(i)); 199 d.device = detectAjbrec(mounts.at(i));
199 d.mountpoint = mounts.at(i); 200 d.mountpoint = mounts.at(i);
200 d.status = PlayerOk; 201 d.status = PlayerOk;
201 if(!d.device.isEmpty()) { 202 if(!d.device.isEmpty()) {
202 qDebug() << "[Autodetect]" << d.device; 203 LOG_INFO() << d.device;
203 updateDetectedDevice(d); 204 updateDetectedDevice(d);
204 } 205 }
205 } 206 }
@@ -255,7 +256,7 @@ void Autodetection::mergePatcher(void)
255 n = ipod_scan(&ipod); 256 n = ipod_scan(&ipod);
256 // FIXME: handle more than one Ipod connected in ipodpatcher. 257 // FIXME: handle more than one Ipod connected in ipodpatcher.
257 if(n == 1) { 258 if(n == 1) {
258 qDebug() << "[Autodetect] Ipod found:" << ipod.modelstr << "at" << ipod.diskname; 259 LOG_INFO() << "Ipod found:" << ipod.modelstr << "at" << ipod.diskname;
259 // since resolveMountPoint is doing exact matches we need to select 260 // since resolveMountPoint is doing exact matches we need to select
260 // the correct partition. 261 // the correct partition.
261 QString mp(ipod.diskname); 262 QString mp(ipod.diskname);
@@ -276,7 +277,7 @@ void Autodetection::mergePatcher(void)
276 updateDetectedDevice(d); 277 updateDetectedDevice(d);
277 } 278 }
278 else { 279 else {
279 qDebug() << "[Autodetect] ipodpatcher: no Ipod found." << n; 280 LOG_INFO() << "ipodpatcher: no Ipod found." << n;
280 } 281 }
281 ipod_dealloc_buffer(&ipod); 282 ipod_dealloc_buffer(&ipod);
282 283
@@ -286,8 +287,8 @@ void Autodetection::mergePatcher(void)
286 sansa_alloc_buffer(&sansa, BUFFER_SIZE); 287 sansa_alloc_buffer(&sansa, BUFFER_SIZE);
287 n = sansa_scan(&sansa); 288 n = sansa_scan(&sansa);
288 if(n == 1) { 289 if(n == 1) {
289 qDebug() << "[Autodetect] Sansa found:" 290 LOG_INFO() << "Sansa found:"
290 << sansa.targetname << "at" << sansa.diskname; 291 << sansa.targetname << "at" << sansa.diskname;
291 QString mp(sansa.diskname); 292 QString mp(sansa.diskname);
292#ifdef Q_OS_LINUX 293#ifdef Q_OS_LINUX
293 mp.append("1"); 294 mp.append("1");
@@ -302,7 +303,7 @@ void Autodetection::mergePatcher(void)
302 updateDetectedDevice(d); 303 updateDetectedDevice(d);
303 } 304 }
304 else { 305 else {
305 qDebug() << "[Autodetect] sansapatcher: no Sansa found." << n; 306 LOG_INFO() << "sansapatcher: no Sansa found." << n;
306 } 307 }
307 sansa_dealloc_buffer(&sansa); 308 sansa_dealloc_buffer(&sansa);
308} 309}
@@ -323,8 +324,8 @@ QString Autodetection::detectAjbrec(QString root)
323 // recorder v1 has the binary length in the first 4 bytes, so check 324 // recorder v1 has the binary length in the first 4 bytes, so check
324 // for them first. 325 // for them first.
325 int len = (header[0]<<24) | (header[1]<<16) | (header[2]<<8) | header[3]; 326 int len = (header[0]<<24) | (header[1]<<16) | (header[2]<<8) | header[3];
326 qDebug() << "[Autodetect] ABJREC possible bin length:" << len 327 LOG_INFO() << "abjrec.ajz possible bin length:" << len
327 << "file len:" << f.size(); 328 << "file len:" << f.size();
328 if((f.size() - 6) == len) 329 if((f.size() - 6) == len)
329 return "recorder"; 330 return "recorder";
330 331