Beispiel #1
0
        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);
        }
Beispiel #2
0
        public GUdev.Device GudevDeviceFromGioDrive(GLib.IDrive drive)
        {
            GUdev.Device device = null;

            if (drive == null)
            {
                return(null);
            }

            string devFile = drive.GetIdentifier("unix-device");

            if (!String.IsNullOrEmpty(devFile))
            {
                device = client.QueryByDeviceFile(devFile);
            }

            return(device);
        }