From bc9fed6cbd13aa1b9172cbbcc5912c343c250af8 Mon Sep 17 00:00:00 2001 From: Niklas Goby Date: Tue, 12 Apr 2011 14:58:37 +0200 Subject: changes in the method getVendorProductSerialNumber() in class sysInfo now we can see the product name and the manufacturer as well TOTO:: determine a usb flash drive / stick cause until now we get informations about every usb device which is connected to the client pc --- src/fbgui.cpp | 1 + src/sysinfo.cpp | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/fbgui.cpp b/src/fbgui.cpp index e18603c..4aba08f 100644 --- a/src/fbgui.cpp +++ b/src/fbgui.cpp @@ -27,6 +27,7 @@ fbgui::fbgui() //sil->getInfoMainboardSerial(); SysInfo si; si.getInfo("mbserial"); + si.getInfo("usb"); setupLayout(); diff --git a/src/sysinfo.cpp b/src/sysinfo.cpp index af649ed..135db11 100644 --- a/src/sysinfo.cpp +++ b/src/sysinfo.cpp @@ -140,8 +140,8 @@ const QString SysInfo::getUsbVendorIdProductIdSerialNumber() qxtLog->debug()<< tag + "failed to get device descriptor"; return "error"; } - infos.insert("vendorId",QString(desc.idVendor)); - infos.insert("productId",QString(desc.idProduct)); + infos.insert("vendorId",desc.idVendor); + infos.insert("productId",desc.idProduct); unsigned char string[256]; libusb_device_handle *handle; re = libusb_open(dev, &handle); @@ -155,6 +155,19 @@ const QString SysInfo::getUsbVendorIdProductIdSerialNumber() return "error"; } infos.insert("serialnumber",QString((const char *)string)); + re = libusb_get_string_descriptor_ascii(handle,desc.iProduct, string, sizeof(string)); + if (re < 0) { + qxtLog->debug()<< tag + "failed to get Product"; + return "error"; + } + infos.insert("product",QString((const char *)string)); + re = libusb_get_string_descriptor_ascii(handle,desc.iManufacturer, string, sizeof(string)); + if (re < 0) { + qxtLog->debug()<< tag + "failed to get Product"; + return "error"; + } + infos.insert("manuacturer",QString((const char *)string)); + list << infos; libusb_close(handle); } @@ -162,6 +175,7 @@ const QString SysInfo::getUsbVendorIdProductIdSerialNumber() libusb_exit(ctx); //close the session QByteArray json = serializer.serialize(list); + qxtLog->debug()<< tag + "json object: " + json; return json; } -- cgit v1.2.3-55-g7522