Fix pictbridge camera detection

Add new device matching rules
pull/16/head
Timothy Pearson 12 years ago
parent b1346b88ce
commit d2480b90f5

@ -3190,6 +3190,10 @@ TDEGenericDevice* TDEHardwareDevices::classifyUnknownDevice(udev_device* dev, TD
else if (devicesubsystem == "usb-serial") { else if (devicesubsystem == "usb-serial") {
if (!device) device = new TDEGenericDevice(TDEGenericDeviceType::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") { else if (devicesubsystem == "thermal") {
// FIXME // FIXME
// Figure out a way to differentiate between ThermalControl (fans and coolers) and ThermalSensor types // 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 (!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") if ((devicesubsystem == "event_source")
|| (devicesubsystem == "rtc")) { || (devicesubsystem == "rtc")) {
if (!device) device = new TDEGenericDevice(TDEGenericDeviceType::Mainboard); if (!device) device = new TDEGenericDevice(TDEGenericDeviceType::Mainboard);
@ -3393,16 +3403,39 @@ TDEGenericDevice* TDEHardwareDevices::classifyUnknownDevice(udev_device* dev, TD
// Last ditch attempt at classification // Last ditch attempt at classification
// Likely inaccurate and sweeping // Likely inaccurate and sweeping
if ((devicesubsystem == "usb") if ((devicesubsystem == "usb")
|| (devicesubsystem == "usb_device")
|| (devicesubsystem == "usbmon")) { || (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 // Get USB interface protocol for further classification
int usbInterfaceProtocol = -1; int usbInterfaceProtocol = -1;
TQFile ifaceprotofile(current_path + "/bInterfaceProtocol"); {
if (ifaceprotofile.open(IO_ReadOnly)) { TQFile ifaceprotofile(current_path + "/bInterfaceProtocol");
TQTextStream stream( &ifaceprotofile ); if (ifaceprotofile.open(IO_ReadOnly)) {
usbInterfaceProtocol = stream.readLine().toUInt(); TQTextStream stream( &ifaceprotofile );
ifaceprotofile.close(); usbInterfaceProtocol = stream.readLine().toUInt();
ifaceprotofile.close();
}
} }
if (usbInterfaceProtocol == 1) { if ((usbInterfaceClass == 6) && (usbInterfaceSubClass == 1) && (usbInterfaceProtocol == 1)) {
// PictBridge // PictBridge
if (!device) { if (!device) {
device = new TDEStorageDevice(TDEGenericDeviceType::Disk); device = new TDEStorageDevice(TDEGenericDeviceType::Disk);

Loading…
Cancel
Save