summaryrefslogtreecommitdiff
path: root/rbutil/rbutilqt/base/autodetection.cpp
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2009-08-08 12:12:49 +0000
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2009-08-08 12:12:49 +0000
commitbd5b744a6daa17f99a528bd62fdc45203d17233e (patch)
treeb9754a63b5033093a975c12d0b353d54a9a33c38 /rbutil/rbutilqt/base/autodetection.cpp
parentc8e39403f414814d07129f9c7dc0f0c04edbf45f (diff)
downloadrockbox-bd5b744a6daa17f99a528bd62fdc45203d17233e.tar.gz
rockbox-bd5b744a6daa17f99a528bd62fdc45203d17233e.zip
Clean up some debug output, kill some trailing spaces and break some overly long lines.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22204 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil/rbutilqt/base/autodetection.cpp')
-rw-r--r--rbutil/rbutilqt/base/autodetection.cpp35
1 files changed, 18 insertions, 17 deletions
diff --git a/rbutil/rbutilqt/base/autodetection.cpp b/rbutil/rbutilqt/base/autodetection.cpp
index 30651077f2..386b39057a 100644
--- a/rbutil/rbutilqt/base/autodetection.cpp
+++ b/rbutil/rbutilqt/base/autodetection.cpp
@@ -74,7 +74,7 @@ bool Autodetection::detect()
74 { 74 {
75 // do the file checking 75 // do the file checking
76 QDir dir(mounts.at(i)); 76 QDir dir(mounts.at(i));
77 qDebug() << "paths to check for player specific files:" << mounts; 77 qDebug() << "[Autodetect] paths to check:" << mounts;
78 if(dir.exists()) 78 if(dir.exists())
79 { 79 {
80 // check logfile first. 80 // check logfile first.
@@ -85,7 +85,7 @@ bool Autodetection::detect()
85 if(m_device.isEmpty()) 85 if(m_device.isEmpty())
86 m_device = log.value("platform").toString(); 86 m_device = log.value("platform").toString();
87 m_mountpoint = mounts.at(i); 87 m_mountpoint = mounts.at(i);
88 qDebug() << "rbutil.log detected:" << m_device << m_mountpoint; 88 qDebug() << "[Autodetect] rbutil.log detected:" << m_device << m_mountpoint;
89 return true; 89 return true;
90 } 90 }
91 } 91 }
@@ -97,12 +97,13 @@ bool Autodetection::detect()
97 if(m_device.isEmpty()) 97 if(m_device.isEmpty())
98 { 98 {
99 m_device = info.target(); 99 m_device = info.target();
100 } 100 }
101 m_mountpoint = mounts.at(i); 101 m_mountpoint = mounts.at(i);
102 qDebug() << "rockbox-info.txt detected:" << m_device << m_mountpoint; 102 qDebug() << "[Autodetect] rockbox-info.txt detected:"
103 << m_device << m_mountpoint;
103 return true; 104 return true;
104 } 105 }
105 106
106 // check for some specific files in root folder 107 // check for some specific files in root folder
107 QDir root(mounts.at(i)); 108 QDir root(mounts.at(i));
108 QStringList rootentries = root.entryList(QDir::Files); 109 QStringList rootentries = root.entryList(QDir::Files);
@@ -129,10 +130,10 @@ bool Autodetection::detect()
129 } 130 }
130 if(rootentries.contains("ajbrec.ajz", Qt::CaseInsensitive)) 131 if(rootentries.contains("ajbrec.ajz", Qt::CaseInsensitive))
131 { 132 {
132 qDebug() << "ajbrec.ajz found. Trying detectAjbrec()"; 133 qDebug() << "[Autodetect] ajbrec.ajz found. Trying detectAjbrec()";
133 if(detectAjbrec(mounts.at(i))) { 134 if(detectAjbrec(mounts.at(i))) {
134 m_mountpoint = mounts.at(i); 135 m_mountpoint = mounts.at(i);
135 qDebug() << m_device; 136 qDebug() << "[Autodetect]" << m_device;
136 return true; 137 return true;
137 } 138 }
138 } 139 }
@@ -167,13 +168,13 @@ bool Autodetection::detect()
167 struct ipod_t ipod; 168 struct ipod_t ipod;
168 n = ipod_scan(&ipod); 169 n = ipod_scan(&ipod);
169 if(n == 1) { 170 if(n == 1) {
170 qDebug() << "Ipod found:" << ipod.modelstr << "at" << ipod.diskname; 171 qDebug() << "[Autodetect] Ipod found:" << ipod.modelstr << "at" << ipod.diskname;
171 m_device = ipod.targetname; 172 m_device = ipod.targetname;
172 m_mountpoint = resolveMountPoint(ipod.diskname); 173 m_mountpoint = resolveMountPoint(ipod.diskname);
173 return true; 174 return true;
174 } 175 }
175 else { 176 else {
176 qDebug() << "ipodpatcher: no Ipod found." << n; 177 qDebug() << "[Autodetect] ipodpatcher: no Ipod found." << n;
177 } 178 }
178 free(ipod_sectorbuf); 179 free(ipod_sectorbuf);
179 ipod_sectorbuf = NULL; 180 ipod_sectorbuf = NULL;
@@ -185,13 +186,13 @@ bool Autodetection::detect()
185 struct sansa_t sansa; 186 struct sansa_t sansa;
186 n = sansa_scan(&sansa); 187 n = sansa_scan(&sansa);
187 if(n == 1) { 188 if(n == 1) {
188 qDebug() << "Sansa found:" << sansa.targetname << "at" << sansa.diskname; 189 qDebug() << "[Autodetect] Sansa found:" << sansa.targetname << "at" << sansa.diskname;
189 m_device = QString("sansa%1").arg(sansa.targetname); 190 m_device = QString("sansa%1").arg(sansa.targetname);
190 m_mountpoint = resolveMountPoint(sansa.diskname); 191 m_mountpoint = resolveMountPoint(sansa.diskname);
191 return true; 192 return true;
192 } 193 }
193 else { 194 else {
194 qDebug() << "sansapatcher: no Sansa found." << n; 195 qDebug() << "[Autodetect] sansapatcher: no Sansa found." << n;
195 } 196 }
196 free(sansa_sectorbuf); 197 free(sansa_sectorbuf);
197 sansa_sectorbuf = NULL; 198 sansa_sectorbuf = NULL;
@@ -246,7 +247,7 @@ QStringList Autodetection::mountpoints()
246 */ 247 */
247QString Autodetection::resolveMountPoint(QString device) 248QString Autodetection::resolveMountPoint(QString device)
248{ 249{
249 qDebug() << "Autodetection::resolveMountPoint(QString)" << device; 250 qDebug() << "[Autodetect] resolving mountpoint:" << device;
250 251
251#if defined(Q_OS_LINUX) 252#if defined(Q_OS_LINUX)
252 FILE *mn = setmntent("/etc/mtab", "r"); 253 FILE *mn = setmntent("/etc/mtab", "r");
@@ -302,7 +303,7 @@ QString Autodetection::resolveMountPoint(QString device)
302 break; 303 break;
303 } 304 }
304 } 305 }
305 qDebug() << "Autodetection::resolveMountPoint(QString)" << "->" << result; 306 qDebug() << "[Autodetect] resolved mountpoint is:" << result;
306 if(!result.isEmpty()) 307 if(!result.isEmpty())
307 return result + ":/"; 308 return result + ":/";
308#endif 309#endif
@@ -316,7 +317,7 @@ QString Autodetection::resolveMountPoint(QString device)
316 */ 317 */
317QString Autodetection::resolveDevicename(QString path) 318QString Autodetection::resolveDevicename(QString path)
318{ 319{
319 qDebug() << __func__; 320 qDebug() << "[Autodetect] resolving device name" << path;
320#if defined(Q_OS_LINUX) 321#if defined(Q_OS_LINUX)
321 FILE *mn = setmntent("/etc/mtab", "r"); 322 FILE *mn = setmntent("/etc/mtab", "r");
322 if(!mn) 323 if(!mn)
@@ -377,7 +378,7 @@ QString Autodetection::resolveDevicename(QString path)
377 if(DeviceIoControl(h, IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS, 378 if(DeviceIoControl(h, IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS,
378 NULL, 0, extents, sizeof(buffer), &written, NULL)) { 379 NULL, 0, extents, sizeof(buffer), &written, NULL)) {
379 if(extents->NumberOfDiskExtents > 1) { 380 if(extents->NumberOfDiskExtents > 1) {
380 qDebug() << "volume spans multiple disks!"; 381 qDebug() << "[Autodetect] resolving device name: volume spans multiple disks!";
381 return ""; 382 return "";
382 } 383 }
383 //qDebug() << "Disk:" << extents->Extents[0].DiskNumber; 384 //qDebug() << "Disk:" << extents->Extents[0].DiskNumber;
@@ -441,8 +442,8 @@ bool Autodetection::detectAjbrec(QString root)
441 // recorder v1 has the binary length in the first 4 bytes, so check 442 // recorder v1 has the binary length in the first 4 bytes, so check
442 // for them first. 443 // for them first.
443 int len = (header[0]<<24) | (header[1]<<16) | (header[2]<<8) | header[3]; 444 int len = (header[0]<<24) | (header[1]<<16) | (header[2]<<8) | header[3];
444 qDebug() << "possible bin length:" << len; 445 qDebug() << "[Autodetect] ABJREC possible bin length:" << len
445 qDebug() << "file len:" << f.size(); 446 << "file len:" << f.size();
446 if((f.size() - 6) == len) 447 if((f.size() - 6) == len)
447 m_device = "recorder"; 448 m_device = "recorder";
448 449