[PC-BSD Commits] r18705 - pcbsd/current/src-qt4/pc-mounttray
svn at pcbsd.org
svn at pcbsd.org
Wed Aug 29 11:01:16 PDT 2012
Author: kenmoore
Date: 2012-08-29 18:01:16 +0000 (Wed, 29 Aug 2012)
New Revision: 18705
Modified:
pcbsd/current/src-qt4/pc-mounttray/mountTray.cpp
Log:
Add another filter for USB devices, do not show any of them that display less than 1 MB of storage space.
Modified: pcbsd/current/src-qt4/pc-mounttray/mountTray.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-mounttray/mountTray.cpp 2012-08-29 18:00:46 UTC (rev 18704)
+++ pcbsd/current/src-qt4/pc-mounttray/mountTray.cpp 2012-08-29 18:01:16 UTC (rev 18705)
@@ -123,6 +123,14 @@
//Get the Device Info
QString cmd = "file -s "+deviceLocation;
QString output = Utils::runShellCommand(cmd).join(" ");
+ //qDebug() << "File -s output:" << output;
+ // - get the device storage size
+ int kb = output.section("sectors ",1,1).section(",",0,0).section("(",0,0).simplified().toInt();
+ //Filter out all devices with less than a MB of storage
+ //qDebug() << "kb detected:" << kb;
+ if( (kb < 1024) && (type=="USB") ){
+ return newdev;
+ }
// - get the device label
QString label = output.section("label: \"",1,1).section("\"",0,0).simplified(); //device name
if(label.isEmpty()){
@@ -540,9 +548,9 @@
}
//Perform action if a device is found
if(deviceFound){
- QAction* newdev = newDeviceAction(cdev,cdevtype);
checkDevices(); // this will remove any stale device links
if(isAttached){
+ QAction* newdev = newDeviceAction(cdev,cdevtype);
qDebug() << "New device detected:" << newdev->text() << newdev->whatsThis() << newdev->statusTip();
if( !newdev->statusTip().isEmpty() ){ //make sure the device is valid
if( updateDeviceList( 1 , newdev ) ){
@@ -550,10 +558,10 @@
autoMount(newdev,FALSE);
}
}else{
- qDebug() << " - Ignoring device (Unknown filesystem)";
+ qDebug() << " - Ignoring device (less than 1MB of storage detected)";
}
}else{
- qDebug() << "Device removal detected:" << newdev->whatsThis();
+ qDebug() << "Device removal detected:" << cdev;
}
//Update the Tray menu
updateTrayMenu();
More information about the Commits
mailing list