summaryrefslogtreecommitdiff
path: root/rbutil/rbutilqt
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2010-02-20 22:46:58 +0000
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2010-02-20 22:46:58 +0000
commitb1cc087a6718c027a7d34fde503d3378b753e086 (patch)
tree7f15f50fec89bbf888da16f5e79ac5b7ec3ee7a0 /rbutil/rbutilqt
parent7709113b6a13bc77d17bacaa743a8b628305cd0c (diff)
downloadrockbox-b1cc087a6718c027a7d34fde503d3378b753e086.tar.gz
rockbox-b1cc087a6718c027a7d34fde503d3378b753e086.zip
Be more strict when when resolving devices and allow hfs too.
On OS X HFS is a valid filesystem on an Ipod. When resolving device node to mountpoints and vice versa also check mounts of hfs partitions. This results in trying to install the bootloader on a MacPod to show the (intended) MacPod warning instead of failing with a "could not open ipod" error because no valid device node could be retrieved. Also, be more strict on matching to prevent problems with one name being a subset of another. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24802 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil/rbutilqt')
-rw-r--r--rbutil/rbutilqt/base/autodetection.cpp30
1 files changed, 22 insertions, 8 deletions
diff --git a/rbutil/rbutilqt/base/autodetection.cpp b/rbutil/rbutilqt/base/autodetection.cpp
index 8e91dc32b1..bafa88d8bf 100644
--- a/rbutil/rbutilqt/base/autodetection.cpp
+++ b/rbutil/rbutilqt/base/autodetection.cpp
@@ -265,8 +265,11 @@ QString Autodetection::resolveMountPoint(QString device)
265 265
266 struct mntent *ent; 266 struct mntent *ent;
267 while((ent = getmntent(mn))) { 267 while((ent = getmntent(mn))) {
268 if(QString(ent->mnt_fsname).startsWith(device) 268 // Check for valid filesystem. Allow hfs too, as an Ipod might be a
269 && QString(ent->mnt_type).contains("vfat", Qt::CaseInsensitive)) { 269 // MacPod.
270 if(QString(ent->mnt_fsname) == device
271 && (QString(ent->mnt_type).contains("vfat", Qt::CaseInsensitive)
272 || QString(ent->mnt_type).contains("hfs", Qt::CaseInsensitive))) {
270 endmntent(mn); 273 endmntent(mn);
271 qDebug() << "[Autodetect] resolved mountpoint is:" << ent->mnt_dir; 274 qDebug() << "[Autodetect] resolved mountpoint is:" << ent->mnt_dir;
272 return QString(ent->mnt_dir); 275 return QString(ent->mnt_dir);
@@ -282,8 +285,11 @@ QString Autodetection::resolveMountPoint(QString device)
282 285
283 num = getmntinfo(&mntinf, MNT_WAIT); 286 num = getmntinfo(&mntinf, MNT_WAIT);
284 while(num--) { 287 while(num--) {
285 if(QString(mntinf->f_mntfromname).startsWith(device) 288 // Check for valid filesystem. Allow hfs too, as an Ipod might be a
286 && QString(mntinf->f_fstypename).contains("msdos", Qt::CaseInsensitive)) { 289 // MacPod.
290 if(QString(mntinf->f_mntfromname) == device
291 && (QString(mntinf->f_fstypename).contains("msdos", Qt::CaseInsensitive)
292 || QString(mntinf->f_fstypename).contains("hfs", Qt::CaseInsensitive))) {
287 qDebug() << "[Autodetect] resolved mountpoint is:" << mntinf->f_mntonname; 293 qDebug() << "[Autodetect] resolved mountpoint is:" << mntinf->f_mntonname;
288 return QString(mntinf->f_mntonname); 294 return QString(mntinf->f_mntonname);
289 } 295 }
@@ -324,8 +330,13 @@ QString Autodetection::resolveDevicename(QString path)
324 330
325 struct mntent *ent; 331 struct mntent *ent;
326 while((ent = getmntent(mn))) { 332 while((ent = getmntent(mn))) {
327 if(QString(ent->mnt_dir).startsWith(path) 333 // check for valid filesystem type.
328 && QString(ent->mnt_type).contains("vfat", Qt::CaseInsensitive)) { 334 // Linux can handle hfs (and hfsplus), so consider it a valid file
335 // system. Otherwise resolving the device name would fail, which in
336 // turn would make it impossible to warn about a MacPod.
337 if(QString(ent->mnt_dir) == path
338 && (QString(ent->mnt_type).contains("vfat", Qt::CaseInsensitive)
339 || QString(ent->mnt_type).contains("hfs", Qt::CaseInsensitive))) {
329 endmntent(mn); 340 endmntent(mn);
330 qDebug() << "[Autodetect] device name is" << ent->mnt_fsname; 341 qDebug() << "[Autodetect] device name is" << ent->mnt_fsname;
331 return QString(ent->mnt_fsname); 342 return QString(ent->mnt_fsname);
@@ -341,8 +352,11 @@ QString Autodetection::resolveDevicename(QString path)
341 352
342 num = getmntinfo(&mntinf, MNT_WAIT); 353 num = getmntinfo(&mntinf, MNT_WAIT);
343 while(num--) { 354 while(num--) {
344 if(QString(mntinf->f_mntonname).startsWith(path) 355 // check for valid filesystem type. OS X can handle hfs (hfs+ is
345 && QString(mntinf->f_fstypename).contains("msdos", Qt::CaseInsensitive)) { 356 // treated as hfs), BSD should be the same.
357 if(QString(mntinf->f_mntonname) == path
358 && (QString(mntinf->f_fstypename).contains("msdos", Qt::CaseInsensitive)
359 || QString(mntinf->f_fstypename).contains("hfs", Qt::CaseInsensitive))) {
346 qDebug() << "[Autodetect] device name is" << mntinf->f_mntfromname; 360 qDebug() << "[Autodetect] device name is" << mntinf->f_mntfromname;
347 return QString(mntinf->f_mntfromname); 361 return QString(mntinf->f_mntfromname);
348 } 362 }