Example #1
0
 private static ulong TryGetDevicePropertyInteger(IHalDevice device, string propertyName)
 {
     //if the property does not exist, we don't care
     try
     {
         return(device.GetPropertyInteger(propertyName));
     }
     catch { }
     return(0);
 }
Example #2
0
 private static string TryGetDevicePropertyString(IHalDevice device, string propertyName)
 {
     //if the property does not exist, we don't care
     try
     {
         return(device.GetPropertyString(propertyName));
     }
     catch {}
     return(String.Empty);
 }
Example #3
0
 private static bool TryGetDevicePropertyBoolean(IHalDevice device, string propertyName)
 {
     //if the property does not exist, we don't care
     try
     {
         return(device.GetPropertyBoolean(propertyName));
     }
     catch { }
     return(false);
 }
Example #4
0
		private static ulong TryGetDevicePropertyInteger(IHalDevice device, string propertyName)
		{
			//if the property does not exist, we don't care
			try
			{
				return device.GetPropertyInteger(propertyName);
			}
			catch { }
			return 0;
		}
Example #5
0
		private static bool TryGetDevicePropertyBoolean(IHalDevice device, string propertyName)
		{
			//if the property does not exist, we don't care
			try
			{
				return device.GetPropertyBoolean(propertyName);
			}
			catch { }
			return false;
		}
Example #6
0
		private static string TryGetDevicePropertyString(IHalDevice device, string propertyName)
		{
			//if the property does not exist, we don't care
			try
			{
				return device.GetPropertyString(propertyName);
			}
			catch{}
			return String.Empty;
		}
Example #7
0
        private static bool DeviceIsOnUsbBus(Connection conn, string halNameOnDbus, IHalDevice device)
        {
            bool deviceIsOnUsbSubsystem;
            bool thereIsAPathToParent;

            do
            {
                string subsystem = TryGetDevicePropertyString(device, "info.subsystem");
                deviceIsOnUsbSubsystem = subsystem.Contains("usb");
                string pathToParent = TryGetDevicePropertyString(device, "info.parent");
                thereIsAPathToParent = String.IsNullOrEmpty(pathToParent);
                device = conn.GetObject <IHalDevice>(halNameOnDbus, new ObjectPath(pathToParent));
            } while (!deviceIsOnUsbSubsystem && !thereIsAPathToParent);
            return(deviceIsOnUsbSubsystem);
        }
Example #8
0
		private static bool DeviceIsOnUsbBus(Connection conn, string halNameOnDbus, IHalDevice device)
		{
			bool deviceIsOnUsbSubsystem;
			bool thereIsAPathToParent;
			do
			{
				string subsystem = TryGetDevicePropertyString(device, "info.subsystem");
				deviceIsOnUsbSubsystem = subsystem.Contains("usb");
				string pathToParent = TryGetDevicePropertyString(device, "info.parent");
				thereIsAPathToParent = String.IsNullOrEmpty(pathToParent);
				device = conn.GetObject<IHalDevice>(halNameOnDbus, new ObjectPath(pathToParent));
			} while (!deviceIsOnUsbSubsystem && !thereIsAPathToParent);
			return deviceIsOnUsbSubsystem;
		}