public override void DeviceInitialize (IDevice device)
{
base.DeviceInitialize (device);
volume = device as IVolume;
if (volume == null || !volume.IsMounted || (usb_device = volume.ResolveRootUsbDevice ()) == null) {
throw new InvalidDeviceException ();
}
ms_device = DeviceMapper.Map (this);
try {
if (ms_device.ShouldIgnoreDevice () || !ms_device.LoadDeviceConfiguration ()) {
ms_device = null;
}
} catch {
ms_device = null;
}
if (!HasMediaCapabilities && ms_device == null) {
throw new InvalidDeviceException ();
}
// Ignore iPods, except ones with .is_audio_player files
if (MediaCapabilities != null && MediaCapabilities.IsType ("ipod")) {
if (ms_device != null && ms_device.HasIsAudioPlayerFile) {
Log.Information (
"Mass Storage Support Loading iPod",
"The USB mass storage audio player support is loading an iPod because it has an .is_audio_player file. " +
"If you aren't running Rockbox or don't know what you're doing, things might not behave as expected."
);
} else {
throw new InvalidDeviceException ();
}
}
Name = ms_device == null ? volume.Name : ms_device.Name;
mount_point = volume.MountPoint;
Initialize ();
if (ms_device != null) {
ms_device.SourceInitialize ();
}
AddDapProperties ();
// TODO differentiate between Audio Players and normal Disks, and include the size, eg "2GB Audio Player"?
//GenericName = Catalog.GetString ("Audio Player");
}