author | mickeyl <mickeyl> | 2005-05-06 10:27:14 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2005-05-06 10:27:14 (UTC) |
commit | e73cc9ec4596e1b5e9eed13af710606f358860ba (patch) (unidiff) | |
tree | e83705b0bd60adcee980c30c3b8b83ad0376cd9c | |
parent | 543d9d7c58c9601dba6f47b3a4011313d1d75499 (diff) | |
download | opie-e73cc9ec4596e1b5e9eed13af710606f358860ba.zip opie-e73cc9ec4596e1b5e9eed13af710606f358860ba.tar.gz opie-e73cc9ec4596e1b5e9eed13af710606f358860ba.tar.bz2 |
quick'n'dirty parsing of USB tree
-rw-r--r-- | noncore/settings/sysinfo/devicesinfo.cpp | 34 | ||||
-rw-r--r-- | noncore/settings/sysinfo/devicesinfo.h | 2 |
2 files changed, 35 insertions, 1 deletions
diff --git a/noncore/settings/sysinfo/devicesinfo.cpp b/noncore/settings/sysinfo/devicesinfo.cpp index 6508d3c..b463e43 100644 --- a/noncore/settings/sysinfo/devicesinfo.cpp +++ b/noncore/settings/sysinfo/devicesinfo.cpp | |||
@@ -257,4 +257,6 @@ void UsbCategory::populate() | |||
257 | 257 | ||
258 | int usbcount = 0; | 258 | int usbcount = 0; |
259 | UsbDevice* lastDev = 0; | ||
260 | UsbDevice* dev = 0; | ||
259 | while ( !usbinfo.atEnd() ) | 261 | while ( !usbinfo.atEnd() ) |
260 | { | 262 | { |
@@ -265,5 +267,21 @@ void UsbCategory::populate() | |||
265 | 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); | 267 | 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); |
266 | 268 | ||
267 | new UsbDevice( this, QString( "USB Device #%1" ).arg( usbcount++ ) ); | 269 | if ( !_level ) |
270 | { | ||
271 | odebug << "adding new bus" << oendl; | ||
272 | dev = new UsbDevice( this, QString( "Generic USB Hub Device" ) ); | ||
273 | lastDev = dev; | ||
274 | } | ||
275 | else | ||
276 | { | ||
277 | odebug << "adding new dev" << oendl; | ||
278 | dev = new UsbDevice( lastDev, QString( "Generic USB Hub Device" ) ); | ||
279 | lastDev = dev; | ||
280 | } | ||
281 | } | ||
282 | else if ( line.startsWith( "S: Product" ) ) | ||
283 | { | ||
284 | int dp = line.find( '=' ); | ||
285 | dev->setText( 0, dp != -1 ? line.right( line.length()-1-dp ) : "<unknown>" ); | ||
268 | } | 286 | } |
269 | else | 287 | else |
@@ -282,4 +300,10 @@ Device::Device( Category* parent, const QString& name ) | |||
282 | } | 300 | } |
283 | 301 | ||
302 | Device::Device( Device* parent, const QString& name ) | ||
303 | :OListViewItem( parent, name ) | ||
304 | { | ||
305 | devinfo = static_cast<QWidget*>( listView()->parent() ); | ||
306 | } | ||
307 | |||
284 | Device::~Device() | 308 | Device::~Device() |
285 | { | 309 | { |
@@ -348,4 +372,12 @@ UsbDevice::UsbDevice( Category* parent, const QString& name ) | |||
348 | } | 372 | } |
349 | 373 | ||
374 | //================================================================================================= | ||
375 | UsbDevice::UsbDevice( UsbDevice* parent, const QString& name ) | ||
376 | :Device( parent, name ) | ||
377 | { | ||
378 | details = new QPushButton( name, devinfo ); | ||
379 | details->hide(); | ||
380 | } | ||
381 | |||
350 | UsbDevice::~UsbDevice() | 382 | UsbDevice::~UsbDevice() |
351 | { | 383 | { |
diff --git a/noncore/settings/sysinfo/devicesinfo.h b/noncore/settings/sysinfo/devicesinfo.h index 586d204..c601a96 100644 --- a/noncore/settings/sysinfo/devicesinfo.h +++ b/noncore/settings/sysinfo/devicesinfo.h | |||
@@ -122,4 +122,5 @@ class Device : public Opie::Ui::OListViewItem | |||
122 | public: | 122 | public: |
123 | Device( Category* parent, const QString& name ); | 123 | Device( Category* parent, const QString& name ); |
124 | Device( Device* parent, const QString& name ); | ||
124 | ~Device(); | 125 | ~Device(); |
125 | 126 | ||
@@ -167,4 +168,5 @@ class UsbDevice : public Device | |||
167 | public: | 168 | public: |
168 | UsbDevice( Category* parent, const QString& name ); | 169 | UsbDevice( Category* parent, const QString& name ); |
170 | UsbDevice( UsbDevice* parent, const QString& name ); | ||
169 | ~UsbDevice(); | 171 | ~UsbDevice(); |
170 | 172 | ||