Back to index

lshw  02.16
pcmcia.cc
Go to the documentation of this file.
00001 #include "version.h"
00002 #include "pcmcia.h"
00003 #include "osutils.h"
00004 #include "sysfs.h"
00005 #include <sys/types.h>
00006 #include <sys/stat.h>
00007 #include <fcntl.h>
00008 #include <unistd.h>
00009 #include <stdio.h>
00010 #include <stdlib.h>
00011 #include <string.h>
00012 #include <errno.h>
00013 #include <dirent.h>
00014 
00015 __ID("@(#) $Id$");
00016 
00017 #define SYS_CLASS_PCMCIASOCKET  "/sys/class/pcmcia_socket"
00018 #define CLASS_PCMCIASOCKET  "pcmcia_socket"
00019 
00020 bool scan_pcmcia(hwNode & n)
00021 {
00022   bool result = false;
00023   hwNode *core = n.getChild("core");
00024   int count = 0;
00025   dirent **sockets = NULL;
00026 
00027   return result;
00028 
00029   if (!core)
00030   {
00031     n.addChild(hwNode("core", hw::bus));
00032     core = n.getChild("core");
00033   }
00034 
00035   if(!pushd(SYS_CLASS_PCMCIASOCKET))
00036     return false;
00037 
00038   count = scandir(".", &sockets, NULL, alphasort);
00039   if(count>=0)
00040   {
00041     for(int i=0; i<count; i++)
00042     {
00043       if(matches(sockets[i]->d_name, "^pcmcia_socket[[:digit:]]+$"))
00044       {
00045         sysfs::entry socket = sysfs::entry::byClass(CLASS_PCMCIASOCKET, sockets[i]->d_name);
00046         printf("found PCMCIA socket: %s\n", sockets[i]->d_name);
00047       }
00048       free(sockets[i]);
00049     }
00050     free(sockets);
00051   }
00052 
00053   popd();
00054   return result;
00055 }