[PC-BSD Commits] r17382 - pcbsd/current/src-qt4/pc-mounttray

svn at pcbsd.org svn at pcbsd.org
Fri Jun 22 05:09:08 PDT 2012


Author: kenmoore
Date: 2012-06-22 12:09:06 +0000 (Fri, 22 Jun 2012)
New Revision: 17382

Modified:
   pcbsd/current/src-qt4/pc-mounttray/mountTray.cpp
Log:
Try to streamline the pc-mounttray startup process with better debug logging, also add known non-storage devices to list so as not to run "file" command on them



Modified: pcbsd/current/src-qt4/pc-mounttray/mountTray.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-mounttray/mountTray.cpp	2012-06-22 09:17:28 UTC (rev 17381)
+++ pcbsd/current/src-qt4/pc-mounttray/mountTray.cpp	2012-06-22 12:09:06 UTC (rev 17382)
@@ -36,17 +36,21 @@
   trayIcon->show();
   
   //Load the automount file and populate the list
+  qDebug() << "-Loading automount device list:" << AMFILE;
   loadAutoMountFile();
 
   //Startup the devd watching process
+  qDebug() << "-Starting up the DEVD watcher";
   startupDevdProc();
   
   //Do an initial scan of the devices with dmesg
+  qDebug() << "-Performing initial device scan";
   initialDeviceScan();
   
   //Update the tray icon
   QAction* junk = new QAction("",this);
   showDeviceNotification(0,junk);
+  qDebug() << "-Program now ready for use";
 }
 
 void MountTray::showDeviceNotification(int ident, QAction* device){
@@ -103,9 +107,14 @@
   if( !deviceLocation.startsWith(DEVICEDIR) ){
     deviceLocation.prepend(DEVICEDIR);
   }
+  QString dev = deviceLocation.section("/",-1);
   newdev->setWhatsThis(deviceLocation);
-  
 
+  //Don't run "file" command on certain devices that are known non-storage devices
+  if(dev.startsWith("pcm") || dev.startsWith("tty") ){
+    return newdev;
+  } 
+
   //Get the Device Info
   QString cmd = "file -s "+deviceLocation;
   QString output = Utils::runShellCommand(cmd).join(" ");
@@ -113,7 +122,7 @@
   QString label = output.section("label: \"",1,1).section("\"",0,0).simplified(); //device name
   if(label.isEmpty()){
     //Try another method to find the device label
-    QString dev = deviceLocation.section("/",-1);
+
     QStringList glout = Utils::runShellCommandSearch("glabel list "+dev,"Name:").split("\n");
     for(int i=0; i<glout.length(); i++){
       if(!glout[i].contains(dev)){
@@ -425,7 +434,7 @@
   //qDebug() << "devs:"<<devs;
   //If there are any devices connected, create actions for them and add them to the list
   for(int i=0; i<devs.length(); i++){
-    if(i==0){ qDebug() << "Existing devices discovered:"; }
+    if(i==0){ qDebug() << "-Existing devices discovered:"; }
     QAction* newdevice = newDeviceAction( devs[i].section(":::",0,0), devs[i].section(":::",1,1) );
     qDebug() << " - "<<newdevice->whatsThis()<<" -> "<<newdevice->text()<<", "<<newdevice->statusTip();
     updateDeviceList(1, newdevice);
@@ -619,7 +628,7 @@
     return;
   }
   USERNAME=username.simplified(); //set the global variable
-  qDebug() << "User detected:" << USERNAME;
+  qDebug() << "-User detected:" << USERNAME;
 }
 
 void MountTray::getDefaultFileManager(){
@@ -631,7 +640,7 @@
   if( fmcmd.isEmpty() || fmcmd.contains("File ") ){fmcmd= "openwith"; } //Default to the "openwith" command
 
   FILEMAN = fmcmd.simplified();
-  qDebug() << "File manager detected:" << FILEMAN;
+  qDebug() << "-File manager detected:" << FILEMAN;
 }
 
 void MountTray::slotOpenMediaDir(){



More information about the Commits mailing list