|
|
@ -502,6 +502,10 @@ TQString TDEStorageDevice::friendlyName() {
|
|
|
|
return devicename;
|
|
|
|
return devicename;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (isDiskOfType(TDEDiskDeviceType::Camera)) {
|
|
|
|
|
|
|
|
return TDEGenericDevice::friendlyName();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (isDiskOfType(TDEDiskDeviceType::Floppy)) {
|
|
|
|
if (isDiskOfType(TDEDiskDeviceType::Floppy)) {
|
|
|
|
return friendlyDeviceType();
|
|
|
|
return friendlyDeviceType();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -559,6 +563,9 @@ TQString TDEStorageDevice::friendlyDeviceType() {
|
|
|
|
if (isDiskOfType(TDEDiskDeviceType::Tape)) {
|
|
|
|
if (isDiskOfType(TDEDiskDeviceType::Tape)) {
|
|
|
|
ret = i18n("Tape Drive");
|
|
|
|
ret = i18n("Tape Drive");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isDiskOfType(TDEDiskDeviceType::Camera)) {
|
|
|
|
|
|
|
|
ret = i18n("Digital Camera");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (isDiskOfType(TDEDiskDeviceType::HDD)) {
|
|
|
|
if (isDiskOfType(TDEDiskDeviceType::HDD)) {
|
|
|
|
ret = i18n("Hard Disk Drive");
|
|
|
|
ret = i18n("Hard Disk Drive");
|
|
|
@ -613,6 +620,9 @@ TQPixmap TDEStorageDevice::icon(KIcon::StdSizes size) {
|
|
|
|
if (isDiskOfType(TDEDiskDeviceType::Tape)) {
|
|
|
|
if (isDiskOfType(TDEDiskDeviceType::Tape)) {
|
|
|
|
ret = DesktopIcon("tape_unmount", size);
|
|
|
|
ret = DesktopIcon("tape_unmount", size);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isDiskOfType(TDEDiskDeviceType::Camera)) {
|
|
|
|
|
|
|
|
ret = DesktopIcon("camera_unmount");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (isDiskOfType(TDEDiskDeviceType::HDD)) {
|
|
|
|
if (isDiskOfType(TDEDiskDeviceType::HDD)) {
|
|
|
|
ret = DesktopIcon("hdd_unmount", size);
|
|
|
|
ret = DesktopIcon("hdd_unmount", size);
|
|
|
@ -743,10 +753,7 @@ TQString TDEStorageDevice::mountDevice(TQString mediaName, TQString mountOptions
|
|
|
|
KTempFile passwordFile(TQString::null, "tmp", 0600);
|
|
|
|
KTempFile passwordFile(TQString::null, "tmp", 0600);
|
|
|
|
passwordFile.setAutoDelete(true);
|
|
|
|
passwordFile.setAutoDelete(true);
|
|
|
|
|
|
|
|
|
|
|
|
TQString command = TQString("pmount -p %1 %2 %3 2>&1").arg(passwordFile.name()).arg(mountOptions).arg(deviceNode());
|
|
|
|
TQString command = TQString("pmount -p %1 %2 %3 %4 2>&1").arg(passwordFile.name()).arg(mountOptions).arg(deviceNode()).arg(mediaName);
|
|
|
|
if (!mediaName.isNull()) {
|
|
|
|
|
|
|
|
command.append(mediaName);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FILE *exepipe = popen(command.ascii(), "r");
|
|
|
|
FILE *exepipe = popen(command.ascii(), "r");
|
|
|
|
if (exepipe) {
|
|
|
|
if (exepipe) {
|
|
|
@ -790,10 +797,7 @@ TQString TDEStorageDevice::mountEncryptedDevice(TQString passphrase, TQString me
|
|
|
|
pwFile->writeBlock(passphrase.ascii(), passphrase.length());
|
|
|
|
pwFile->writeBlock(passphrase.ascii(), passphrase.length());
|
|
|
|
pwFile->flush();
|
|
|
|
pwFile->flush();
|
|
|
|
|
|
|
|
|
|
|
|
TQString command = TQString("pmount -p %1 %2 %3 2>&1").arg(passwordFile.name()).arg(mountOptions).arg(deviceNode());
|
|
|
|
TQString command = TQString("pmount -p %1 %2 %3 %4 2>&1").arg(passwordFile.name()).arg(mountOptions).arg(deviceNode()).arg(mediaName);
|
|
|
|
if (!mediaName.isNull()) {
|
|
|
|
|
|
|
|
command.append(mediaName);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FILE *exepipe = popen(command.ascii(), "r");
|
|
|
|
FILE *exepipe = popen(command.ascii(), "r");
|
|
|
|
if (exepipe) {
|
|
|
|
if (exepipe) {
|
|
|
@ -3231,8 +3235,32 @@ TDEGenericDevice* TDEHardwareDevices::classifyUnknownDevice(udev_device* dev, TD
|
|
|
|
// Likely inaccurate and sweeping
|
|
|
|
// Likely inaccurate and sweeping
|
|
|
|
if ((devicesubsystem == "usb")
|
|
|
|
if ((devicesubsystem == "usb")
|
|
|
|
|| (devicesubsystem == "usbmon")) {
|
|
|
|
|| (devicesubsystem == "usbmon")) {
|
|
|
|
|
|
|
|
// 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();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (usbInterfaceProtocol == 1) {
|
|
|
|
|
|
|
|
// PictBridge
|
|
|
|
|
|
|
|
if (!device) {
|
|
|
|
|
|
|
|
device = new TDEStorageDevice(TDEGenericDeviceType::Disk);
|
|
|
|
|
|
|
|
TDEStorageDevice* sdevice = static_cast<TDEStorageDevice*>(device);
|
|
|
|
|
|
|
|
sdevice->internalSetDiskType(TDEDiskDeviceType::Camera);
|
|
|
|
|
|
|
|
TQString parentsyspathudev = systempath;
|
|
|
|
|
|
|
|
parentsyspathudev.truncate(parentsyspathudev.length()-1); // Remove trailing slash
|
|
|
|
|
|
|
|
parentsyspathudev.truncate(parentsyspathudev.findRev("/"));
|
|
|
|
|
|
|
|
struct udev_device *parentdev;
|
|
|
|
|
|
|
|
parentdev = udev_device_new_from_syspath(m_udevStruct, parentsyspathudev.ascii());
|
|
|
|
|
|
|
|
devicenode = (udev_device_get_devnode(parentdev));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
if (!device) device = new TDEGenericDevice(TDEGenericDeviceType::OtherUSB);
|
|
|
|
if (!device) device = new TDEGenericDevice(TDEGenericDeviceType::OtherUSB);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
if (devicesubsystem == "pci") {
|
|
|
|
if (devicesubsystem == "pci") {
|
|
|
|
if (!device) device = new TDEGenericDevice(TDEGenericDeviceType::OtherPeripheral);
|
|
|
|
if (!device) device = new TDEGenericDevice(TDEGenericDeviceType::OtherPeripheral);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -3272,6 +3300,13 @@ TDEGenericDevice* TDEHardwareDevices::classifyUnknownDevice(udev_device* dev, TD
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (device->type() == TDEGenericDeviceType::Disk) {
|
|
|
|
if (device->type() == TDEGenericDeviceType::Disk) {
|
|
|
|
|
|
|
|
TDEStorageDevice* sdevice = static_cast<TDEStorageDevice*>(device);
|
|
|
|
|
|
|
|
if (sdevice->diskType() & TDEDiskDeviceType::Camera) {
|
|
|
|
|
|
|
|
// PictBridge cameras are special and should not be classified by standard rules
|
|
|
|
|
|
|
|
sdevice->internalSetDiskStatus(TDEDiskDeviceStatus::Removable);
|
|
|
|
|
|
|
|
sdevice->internalSetFileSystemName("pictbridge");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
bool removable = false;
|
|
|
|
bool removable = false;
|
|
|
|
bool hotpluggable = false;
|
|
|
|
bool hotpluggable = false;
|
|
|
|
|
|
|
|
|
|
|
@ -3357,8 +3392,6 @@ TDEGenericDevice* TDEHardwareDevices::classifyUnknownDevice(udev_device* dev, TD
|
|
|
|
device->internalSetVendorModel(devicemodel);
|
|
|
|
device->internalSetVendorModel(devicemodel);
|
|
|
|
device->internalSetDeviceBus(devicebus);
|
|
|
|
device->internalSetDeviceBus(devicebus);
|
|
|
|
|
|
|
|
|
|
|
|
TDEStorageDevice* sdevice = static_cast<TDEStorageDevice*>(device);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TDEDiskDeviceType::TDEDiskDeviceType disktype = sdevice->diskType();
|
|
|
|
TDEDiskDeviceType::TDEDiskDeviceType disktype = sdevice->diskType();
|
|
|
|
TDEDiskDeviceStatus::TDEDiskDeviceStatus diskstatus = TDEDiskDeviceStatus::Null;
|
|
|
|
TDEDiskDeviceStatus::TDEDiskDeviceStatus diskstatus = TDEDiskDeviceStatus::Null;
|
|
|
|
|
|
|
|
|
|
|
@ -3540,6 +3573,7 @@ TDEGenericDevice* TDEHardwareDevices::classifyUnknownDevice(udev_device* dev, TD
|
|
|
|
|
|
|
|
|
|
|
|
sdevice->internalSetDiskLabel(disklabel);
|
|
|
|
sdevice->internalSetDiskLabel(disklabel);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (device->type() == TDEGenericDeviceType::Network) {
|
|
|
|
if (device->type() == TDEGenericDeviceType::Network) {
|
|
|
|
// Network devices don't have devices nodes per se, but we can at least return the Linux network name...
|
|
|
|
// Network devices don't have devices nodes per se, but we can at least return the Linux network name...
|
|
|
|