summaryrefslogtreecommitdiff
path: root/noncore/settings/sysinfo/devicesinfo.cpp
Unidiff
Diffstat (limited to 'noncore/settings/sysinfo/devicesinfo.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/sysinfo/devicesinfo.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/settings/sysinfo/devicesinfo.cpp b/noncore/settings/sysinfo/devicesinfo.cpp
index 164d608..428cfd4 100644
--- a/noncore/settings/sysinfo/devicesinfo.cpp
+++ b/noncore/settings/sysinfo/devicesinfo.cpp
@@ -220,97 +220,97 @@ void CardsCategory::populate()
220UsbCategory::UsbCategory( DevicesView* parent ) 220UsbCategory::UsbCategory( DevicesView* parent )
221 :Category( parent, "4. Universal Serial Bus" ) 221 :Category( parent, "4. Universal Serial Bus" )
222{ 222{
223} 223}
224 224
225UsbCategory::~UsbCategory() 225UsbCategory::~UsbCategory()
226{ 226{
227} 227}
228 228
229void UsbCategory::populate() 229void 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, "(no USB found)" ); 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;
260 } 260 }
261 else 261 else
262 { 262 {
263 odebug << "adding new dev" << oendl; 263 odebug << "adding new dev" << oendl;
264 dev = new UsbDevice( lastDev, QString( "Generic USB Hub Device" ) ); 264 dev = new UsbDevice( lastDev, QString( "Generic USB Hub Device" ) );
265 lastDev = dev; 265 lastDev = dev;
266 } 266 }
267 } 267 }
268 else if ( line.startsWith( "S: Product" ) ) 268 else if ( dev && line.startsWith( "S: Product" ) )
269 { 269 {
270 int dp = line.find( '=' ); 270 int dp = line.find( '=' );
271 dev->setText( 0, dp != -1 ? line.right( line.length()-1-dp ) : "<unknown>" ); 271 dev->setText( 0, dp != -1 ? line.right( line.length()-1-dp ) : "<unknown>" );
272 } 272 }
273 else 273 else
274 { 274 {
275 continue; 275 continue;
276 } 276 }
277 } 277 }
278} 278}
279 279
280 280
281//================================================================================================= 281//=================================================================================================
282Device::Device( Category* parent, const QString& name ) 282Device::Device( Category* parent, const QString& name )
283 :OListViewItem( parent, name ) 283 :OListViewItem( parent, name )
284{ 284{
285 devinfo = static_cast<QWidget*>( listView()->parent() ); 285 devinfo = static_cast<QWidget*>( listView()->parent() );
286} 286}
287 287
288Device::Device( Device* parent, const QString& name ) 288Device::Device( Device* parent, const QString& name )
289 :OListViewItem( parent, name ) 289 :OListViewItem( parent, name )
290{ 290{
291 devinfo = static_cast<QWidget*>( listView()->parent() ); 291 devinfo = static_cast<QWidget*>( listView()->parent() );
292} 292}
293 293
294Device::~Device() 294Device::~Device()
295{ 295{
296} 296}
297 297
298 298
299QWidget* Device::detailsWidget() 299QWidget* Device::detailsWidget()
300{ 300{
301 return details; 301 return details;
302} 302}
303 303
304//================================================================================================= 304//=================================================================================================
305CpuDevice::CpuDevice( Category* parent, const QString& name ) 305CpuDevice::CpuDevice( Category* parent, const QString& name )
306 :Device( parent, name ) 306 :Device( parent, name )
307{ 307{
308 OListView* w = new OListView( devinfo ); 308 OListView* w = new OListView( devinfo );
309 details = w; 309 details = w;
310 w->addColumn( "Info" ); 310 w->addColumn( "Info" );
311 w->addColumn( "Value" ); 311 w->addColumn( "Value" );
312 w->hide(); 312 w->hide();
313} 313}
314 314
315CpuDevice::~CpuDevice() 315CpuDevice::~CpuDevice()
316{ 316{