本文整理汇总了C++中USBDevice::parseSysDir方法的典型用法代码示例。如果您正苦于以下问题:C++ USBDevice::parseSysDir方法的具体用法?C++ USBDevice::parseSysDir怎么用?C++ USBDevice::parseSysDir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类USBDevice
的用法示例。
在下文中一共展示了USBDevice::parseSysDir方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parseSys
bool USBDevice::parseSys(QString dname)
{
QDir d(dname);
d.setNameFilter("usb*");
QStringList list = d.entryList();
for(QStringList::Iterator it = list.begin(); it != list.end(); ++it) {
USBDevice* device = new USBDevice();
int bus = 0;
QRegExp bus_reg("[a-z]*([0-9]+)");
if (bus_reg.search(*it) != -1)
bus = bus_reg.cap(1).toInt();
device->parseSysDir(bus, 0, 0, d.absPath() + "/" + *it);
}
return d.count();
}
示例2: parseSysDir
void USBDevice::parseSysDir(int bus, int parent, int level, QString dname)
{
_level = level;
_parent = parent;
_manufacturer = catFile(dname + "/manufacturer");
_product = catFile(dname + "/product");
_bus = bus;
_device = catFile(dname + "/devnum").toUInt();
if (_device == 1)
_product += QString(" (%1)").arg(_bus);
_vendorID = catFile(dname + "/idVendor").toUInt(0, 16);
_prodID = catFile(dname + "/idProduct").toUInt(0, 16);
_class = catFile(dname + "/bDeviceClass").toUInt(0, 16);
_sub = catFile(dname + "/bDeviceSubClass").toUInt(0, 16);
_maxPacketSize = catFile(dname + "/bMaxPacketSize0").toUInt();
_speed = catFile(dname + "/speed").toDouble();
_serial = catFile(dname + "/serial");
_channels = catFile(dname + "/maxchild").toUInt();
double version = catFile(dname + "/version").toDouble();
_verMajor = int(version);
_verMinor = int(10*(version - floor(version)));
QDir dir(dname);
dir.setNameFilter(QString("%1-*").arg(bus));
dir.setFilter(QDir::Dirs);
QStringList list = dir.entryList();
for(QStringList::Iterator it = list.begin(); it != list.end(); ++it) {
if ((*it).contains(':'))
continue;
USBDevice* dev = new USBDevice();
dev->parseSysDir(bus, ++level, _device, dname + "/" + *it);
}
}