Changeset View
Changeset View
Standalone View
Standalone View
Modules/usbview/usbdevices.cpp
Show First 20 Lines • Show All 97 Lines • ▼ Show 20 Line(s) | 69 | void USBDevice::parseSysDir(int bus, int parent, int level, const QString& dname) { | |||
---|---|---|---|---|---|
98 | dir.setFilter(QDir::Dirs); | 98 | dir.setFilter(QDir::Dirs); | ||
99 | const QStringList list = dir.entryList(); | 99 | const QStringList list = dir.entryList(); | ||
100 | 100 | | |||
101 | for (QStringList::const_iterator it = list.constBegin(); it != list.constEnd(); ++it) { | 101 | for (QStringList::const_iterator it = list.constBegin(); it != list.constEnd(); ++it) { | ||
102 | if ((*it).contains(QLatin1Char(':'))) | 102 | if ((*it).contains(QLatin1Char(':'))) | ||
103 | continue; | 103 | continue; | ||
104 | 104 | | |||
105 | USBDevice* dev = new USBDevice(); | 105 | USBDevice* dev = new USBDevice(); | ||
106 | dev->parseSysDir(bus, ++level, _device, dname + QLatin1Char('/') + *it); | 106 | dev->parseSysDir(bus, _device, ++level, dname + QLatin1Char('/') + *it); | ||
107 | } | 107 | } | ||
108 | } | 108 | } | ||
109 | 109 | | |||
110 | void USBDevice::parseLine(const QString& line) { | 110 | void USBDevice::parseLine(const QString& line) { | ||
111 | if (line.startsWith(QLatin1String("T:"))) | 111 | if (line.startsWith(QLatin1String("T:"))) | ||
112 | sscanf(line.toLocal8Bit().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); | 112 | sscanf(line.toLocal8Bit().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); | ||
113 | else if (line.startsWith(QLatin1String("S: Manufacturer"))) | 113 | else if (line.startsWith(QLatin1String("S: Manufacturer"))) | ||
114 | _manufacturer = line.mid(17); | 114 | _manufacturer = line.mid(17); | ||
▲ Show 20 Lines • Show All 321 Lines • Show Last 20 Lines |