From d2480b90f5528c62411c261f53f8583376ce7c8d Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sat, 29 Sep 2012 02:12:41 -0500 Subject: Fix pictbridge camera detection Add new device matching rules --- tdecore/tdehardwaredevices.cpp | 45 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 39 insertions(+), 6 deletions(-) (limited to 'tdecore') diff --git a/tdecore/tdehardwaredevices.cpp b/tdecore/tdehardwaredevices.cpp index 6b9082b22..466815560 100644 --- a/tdecore/tdehardwaredevices.cpp +++ b/tdecore/tdehardwaredevices.cpp @@ -3190,6 +3190,10 @@ TDEGenericDevice* TDEHardwareDevices::classifyUnknownDevice(udev_device* dev, TD else if (devicesubsystem == "usb-serial") { if (!device) device = new TDEGenericDevice(TDEGenericDeviceType::Serial); } + else if ((devicesubsystem == "spi_master") + || (devicesubsystem == "spidev")) { + if (!device) device = new TDEGenericDevice(TDEGenericDeviceType::Serial); + } else if (devicesubsystem == "thermal") { // FIXME // Figure out a way to differentiate between ThermalControl (fans and coolers) and ThermalSensor types @@ -3264,6 +3268,12 @@ TDEGenericDevice* TDEHardwareDevices::classifyUnknownDevice(udev_device* dev, TD if (!device) device = new TDEGenericDevice(TDEGenericDeviceType::Platform); } } + if (devicesubsystem == "mmc_host") { + if (!device) device = new TDEGenericDevice(TDEGenericDeviceType::StorageController); + } + if (devicesubsystem == "mmc") { + if (!device) device = new TDEGenericDevice(TDEGenericDeviceType::Platform); + } if ((devicesubsystem == "event_source") || (devicesubsystem == "rtc")) { if (!device) device = new TDEGenericDevice(TDEGenericDeviceType::Mainboard); @@ -3393,16 +3403,39 @@ TDEGenericDevice* TDEHardwareDevices::classifyUnknownDevice(udev_device* dev, TD // Last ditch attempt at classification // Likely inaccurate and sweeping if ((devicesubsystem == "usb") + || (devicesubsystem == "usb_device") || (devicesubsystem == "usbmon")) { + // Get USB interface class for further classification + int usbInterfaceClass = -1; + { + TQFile ifaceprotofile(current_path + "/bInterfaceClass"); + if (ifaceprotofile.open(IO_ReadOnly)) { + TQTextStream stream( &ifaceprotofile ); + usbInterfaceClass = stream.readLine().toUInt(); + ifaceprotofile.close(); + } + } + // Get USB interface subclass for further classification + int usbInterfaceSubClass = -1; + { + TQFile ifaceprotofile(current_path + "/bInterfaceSubClass"); + if (ifaceprotofile.open(IO_ReadOnly)) { + TQTextStream stream( &ifaceprotofile ); + usbInterfaceSubClass = stream.readLine().toUInt(); + ifaceprotofile.close(); + } + } // Get USB interface protocol for further classification int usbInterfaceProtocol = -1; - TQFile ifaceprotofile(current_path + "/bInterfaceProtocol"); - if (ifaceprotofile.open(IO_ReadOnly)) { - TQTextStream stream( &ifaceprotofile ); - usbInterfaceProtocol = stream.readLine().toUInt(); - ifaceprotofile.close(); + { + TQFile ifaceprotofile(current_path + "/bInterfaceProtocol"); + if (ifaceprotofile.open(IO_ReadOnly)) { + TQTextStream stream( &ifaceprotofile ); + usbInterfaceProtocol = stream.readLine().toUInt(); + ifaceprotofile.close(); + } } - if (usbInterfaceProtocol == 1) { + if ((usbInterfaceClass == 6) && (usbInterfaceSubClass == 1) && (usbInterfaceProtocol == 1)) { // PictBridge if (!device) { device = new TDEStorageDevice(TDEGenericDeviceType::Disk); -- cgit v1.2.1