-rw-r--r-- | noncore/settings/sysinfo/devicesinfo.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/noncore/settings/sysinfo/devicesinfo.cpp b/noncore/settings/sysinfo/devicesinfo.cpp index 176d178..164d608 100644 --- a/noncore/settings/sysinfo/devicesinfo.cpp +++ b/noncore/settings/sysinfo/devicesinfo.cpp | |||
@@ -125,49 +125,49 @@ Category::Category( DevicesView* parent, const QString& name ) | |||
125 | { | 125 | { |
126 | odebug << "Category '" << name << "' inserted. Scanning for devices..." << oendl; | 126 | odebug << "Category '" << name << "' inserted. Scanning for devices..." << oendl; |
127 | } | 127 | } |
128 | 128 | ||
129 | Category::~Category() | 129 | Category::~Category() |
130 | { | 130 | { |
131 | } | 131 | } |
132 | 132 | ||
133 | //================================================================================================= | 133 | //================================================================================================= |
134 | CpuCategory::CpuCategory( DevicesView* parent ) | 134 | CpuCategory::CpuCategory( DevicesView* parent ) |
135 | :Category( parent, "1. Central Processing Unit" ) | 135 | :Category( parent, "1. Central Processing Unit" ) |
136 | { | 136 | { |
137 | } | 137 | } |
138 | 138 | ||
139 | CpuCategory::~CpuCategory() | 139 | CpuCategory::~CpuCategory() |
140 | { | 140 | { |
141 | } | 141 | } |
142 | 142 | ||
143 | void CpuCategory::populate() | 143 | void CpuCategory::populate() |
144 | { | 144 | { |
145 | odebug << "CpuCategory::populate()" << oendl; | 145 | odebug << "CpuCategory::populate()" << oendl; |
146 | QFile cpuinfofile( "/proc/cpuinfo" ); | 146 | QFile cpuinfofile( "/proc/cpuinfo" ); |
147 | if ( !cpuinfofile.exists() || !cpuinfofile.open( IO_ReadOnly ) ) | 147 | if ( !cpuinfofile.exists() || !cpuinfofile.open( IO_ReadOnly ) ) |
148 | { | 148 | { |
149 | new CpuDevice( this, "ERROR: /proc/cpuinfo not found or unaccessible" ); | 149 | new CpuDevice( this, "(no cpu found)" ); |
150 | return; | 150 | return; |
151 | } | 151 | } |
152 | QTextStream cpuinfo( &cpuinfofile ); | 152 | QTextStream cpuinfo( &cpuinfofile ); |
153 | 153 | ||
154 | int cpucount = 0; | 154 | int cpucount = 0; |
155 | CpuDevice* dev = 0; | 155 | CpuDevice* dev = 0; |
156 | 156 | ||
157 | while ( !cpuinfo.atEnd() ) | 157 | while ( !cpuinfo.atEnd() ) |
158 | { | 158 | { |
159 | QString line = cpuinfo.readLine(); | 159 | QString line = cpuinfo.readLine(); |
160 | odebug << "got line '" << line << "'" << oendl; | 160 | odebug << "got line '" << line << "'" << oendl; |
161 | if ( line.lower().startsWith( "processor" ) ) | 161 | if ( line.lower().startsWith( "processor" ) ) |
162 | { | 162 | { |
163 | dev = new CpuDevice( this, QString( "CPU #%1" ).arg( cpucount++ ) ); | 163 | dev = new CpuDevice( this, QString( "CPU #%1" ).arg( cpucount++ ) ); |
164 | dev->addInfo( line ); | 164 | dev->addInfo( line ); |
165 | } | 165 | } |
166 | else | 166 | else |
167 | { | 167 | { |
168 | if ( dev ) dev->addInfo( line ); | 168 | if ( dev ) dev->addInfo( line ); |
169 | } | 169 | } |
170 | } | 170 | } |
171 | } | 171 | } |
172 | 172 | ||
173 | //================================================================================================= | 173 | //================================================================================================= |
@@ -211,49 +211,49 @@ void CardsCategory::populate() | |||
211 | while ( it.current() ) | 211 | while ( it.current() ) |
212 | { | 212 | { |
213 | CardDevice *dev = new CardDevice( this, it.current()->identity() ); | 213 | CardDevice *dev = new CardDevice( this, it.current()->identity() ); |
214 | dev->setInfo( it.current() ); | 214 | dev->setInfo( it.current() ); |
215 | ++it; | 215 | ++it; |
216 | } | 216 | } |
217 | } | 217 | } |
218 | 218 | ||
219 | //================================================================================================= | 219 | //================================================================================================= |
220 | UsbCategory::UsbCategory( DevicesView* parent ) | 220 | UsbCategory::UsbCategory( DevicesView* parent ) |
221 | :Category( parent, "4. Universal Serial Bus" ) | 221 | :Category( parent, "4. Universal Serial Bus" ) |
222 | { | 222 | { |
223 | } | 223 | } |
224 | 224 | ||
225 | UsbCategory::~UsbCategory() | 225 | UsbCategory::~UsbCategory() |
226 | { | 226 | { |
227 | } | 227 | } |
228 | 228 | ||
229 | void UsbCategory::populate() | 229 | void UsbCategory::populate() |
230 | { | 230 | { |
231 | odebug << "UsbCategory::populate()" << oendl; | 231 | odebug << "UsbCategory::populate()" << oendl; |
232 | QFile usbinfofile( "/proc/bus/usb/devices" ); | 232 | QFile usbinfofile( "/proc/bus/usb/devices" ); |
233 | if ( !usbinfofile.exists() || !usbinfofile.open( IO_ReadOnly ) ) | 233 | if ( !usbinfofile.exists() || !usbinfofile.open( IO_ReadOnly ) ) |
234 | { | 234 | { |
235 | new UsbDevice( this, "ERROR: /proc/bus/usb/devices not found or unaccessible" ); | 235 | new UsbDevice( this, "(no USB found)" ); |
236 | return; | 236 | return; |
237 | } | 237 | } |
238 | QTextStream usbinfo( &usbinfofile ); | 238 | QTextStream usbinfo( &usbinfofile ); |
239 | 239 | ||
240 | int _bus, _level, _parent, _port, _count, _device, _channels, _power; | 240 | int _bus, _level, _parent, _port, _count, _device, _channels, _power; |
241 | float _speed; | 241 | float _speed; |
242 | QString _manufacturer, _product, _serial; | 242 | QString _manufacturer, _product, _serial; |
243 | 243 | ||
244 | int usbcount = 0; | 244 | int usbcount = 0; |
245 | UsbDevice* lastDev = 0; | 245 | UsbDevice* lastDev = 0; |
246 | UsbDevice* dev = 0; | 246 | UsbDevice* dev = 0; |
247 | while ( !usbinfo.atEnd() ) | 247 | while ( !usbinfo.atEnd() ) |
248 | { | 248 | { |
249 | QString line = usbinfo.readLine(); | 249 | QString line = usbinfo.readLine(); |
250 | odebug << "got line '" << line << "'" << oendl; | 250 | odebug << "got line '" << line << "'" << oendl; |
251 | if ( line.startsWith( "T:" ) ) | 251 | if ( line.startsWith( "T:" ) ) |
252 | { | 252 | { |
253 | sscanf(line.local8Bit().data(), "T: Bus=%2d Lev=%2d Prnt=%2d Port=%d Cnt=%2d Dev#=%3d Spd=%3f MxCh=%2d", &_bus, &_level, &_parent, &_port, &_count, &_device, &_speed, &_channels); | 253 | sscanf(line.local8Bit().data(), "T: Bus=%2d Lev=%2d Prnt=%2d Port=%d Cnt=%2d Dev#=%3d Spd=%3f MxCh=%2d", &_bus, &_level, &_parent, &_port, &_count, &_device, &_speed, &_channels); |
254 | 254 | ||
255 | if ( !_level ) | 255 | if ( !_level ) |
256 | { | 256 | { |
257 | odebug << "adding new bus" << oendl; | 257 | odebug << "adding new bus" << oendl; |
258 | dev = new UsbDevice( this, QString( "Generic USB Hub Device" ) ); | 258 | dev = new UsbDevice( this, QString( "Generic USB Hub Device" ) ); |
259 | lastDev = dev; | 259 | lastDev = dev; |