bool IpodCollectionFactory::identifySolidDevice( const QString &udi ) const { DEBUG_BLOCK Solid::Device device( udi ); /* Start with device to identify, opportunistically try to identify it as * iPod-compatible. If found not, try its parent. Repeat until parent device is * valid. * * This method DOES return false positives for iPod-like devices which are itself * storage drives, but not storage volumes (such as sdc). This is needed for * iPhone-like devices that have extra code to mount them in IpodHandler. IpodHandler * gracefully fails in case this is old-school iPod, so this shouldn't hurt, only side * effect is that other connection assistant are not tried for these false-identified * devices. It would be of course great if iPhone-like devices could be distinguished * right here - KDE's Solid should be able to help us with it in future, but as of * KDE 4.7.4 it tells us nothing. * * @see MediaDeviceCache::slotAddSolidDevice() for a quirk that is currently also * needed for proper identification of iPhone-like devices. THIS IS CURRENTLY NOT * NEEDED FOR IPOD COLLECTION REWRITE, BUT LEFT FOR REFERENCE. */ while ( device.isValid() ) { if( deviceIsPMPIpodDevice( device ) ) { debug() << "Device" << device.udi() << "identified iPod-like using " "PortableMediaPlayer interface"; return true; } if( deviceIsRootIpodDevice( device ) ) { debug() << "Device" << device.udi() << "identified iPod-like using " "vendor and product name"; return true; } debug() << "Device" << device.udi() << "not identified iPod-like, trying parent device"; device = device.parent(); } debug() << "Device" << device.udi() << "is invalid, returning false. (i.e. was not iPod-like)"; return false; }
bool IpodCollectionFactory::identifySolidDevice( const QString &udi ) const { DEBUG_BLOCK Solid::Device device( udi ); if( deviceIsPMPIpodDevice( device ) ) { debug() << "Device" << device.udi() << "identified iPod-like using " "PortableMediaPlayer interface"; return true; } if( !device.is<Solid::StorageAccess>() ) { debug() << "Device" << device.udi() << "doesn't have PortableMediaPlayer ipod" << "interface or StorageAccess interface -> cannot be and iPod"; return false; } /* Start with device to identify, opportunistically try to identify it as * iPod-compatible. If found not, try its parent. Repeat until parent device is * valid. * * @see MediaDeviceCache::slotAddSolidDevice(), whose iPhone hack shouldn't be * needed since iPod rewrite in Amarok 2.6. */ while ( device.isValid() ) { if( deviceIsRootIpodDevice( device ) ) { debug() << "Device" << device.udi() << "identified iPod-like using " "vendor and product name"; return true; } debug() << "Device" << device.udi() << "not identified iPod-like, trying parent device"; device = device.parent(); } debug() << "Device" << device.udi() << "is invalid, returning false. (i.e. was not iPod-like)"; return false; }