public GUdev.Device GudevDeviceFromGioVolume(GLib.IVolume volume) { GUdev.Device device = null; if (volume == null) { return(null); } var s = volume.GetIdentifier("unix-device"); if (!String.IsNullOrEmpty(s)) { device = client.QueryByDeviceFile(s); } if (device == null) { s = volume.Uuid; foreach (GUdev.Device d in client.QueryBySubsystem("usb")) { if (s == d.GetSysfsAttr("serial")) { device = d; break; } } } return(device); }
private RawVolume CreateRawVolume(GLib.IVolume volume) { GUdev.Device device; if (!volume_device_map.TryGetValue(volume.Handle, out device)) { Hyena.Log.Debug(string.Format("No matching udev device for volume {0}/{1}", volume.Name, volume.Uuid)); return(null); } return(new RawVolume(volume, this, new GioVolumeMetadataSource(volume), new UdevMetadataSource(device))); }
void VolumeRemoved(GLib.IVolume volume) { var h = DeviceRemoved; if (h != null) { var v = CreateRawVolume(volume); if (v == null) { return; } h(this, new MountArgs(new Device(v))); } }
private void VolumeChanged(GLib.IVolume volume) { if (volume == null) { Hyena.Log.Error("Gio.Manager: ignoring VolumeChanged signal with no volume"); return; } var handler = DeviceChanged; if (handler != null) { var raw = CreateRawVolume(volume); if (raw == null) { return; } var device = new Device(raw); handler(this, new MountArgs(HardwareManager.Resolve(device))); } }
private void VolumeAdded(GLib.IVolume volume) { var device = GudevDeviceFromGioVolume(volume); if (device == null) { Hyena.Log.ErrorFormat("VolumeAdded: {0}/{1} with no matching udev device", volume.Name, volume.Uuid); return; } volume_device_map [volume.Handle] = device; var h = DeviceAdded; if (h != null) { var raw = CreateRawVolume(volume); if (raw == null) { return; } var dev = new Device(raw); h(this, new MountArgs(HardwareManager.Resolve(dev))); } }
public RawVolume(GLib.IVolume volume, Manager manager, GioVolumeMetadataSource gioMetadata, UdevMetadataSource udevMetadata) : base(manager, gioMetadata, udevMetadata) { Volume = volume; }