Ejemplo n.º 1
0
 public void Init()
 {
     client.Uevent += Client_Uevent;
     foreach (var device in client.QueryBySubsystem(hidraw_subsystem))
     {
         var args = new UeventArgs()
         {
             Args = new object[] { "add", device }
         };
         Client_Uevent(this, args);
     }
 }
Ejemplo n.º 2
0
        void Client_Uevent(object o, UeventArgs args)
        {
            var usb       = args.Device.GetParentWithSubsystem(usb_subsystem, "usb_device");
            var hid       = args.Device.GetParentWithSubsystem(hid_subsystem, null);
            var idVendor  = usb.GetSysfsAttr("idVendor");
            var idProduct = usb.GetSysfsAttr("idProduct");

            if (idVendor != "0694" || idProduct != "0006")
            {
                return;
            }
            switch (args.Action)
            {
            case "add":
                onDeviceAdded(new Device(hid.GetProperty("HID_NAME"), args.Device.DeviceFile));
                break;

            case "remove":
                break;
            }
        }
Ejemplo n.º 3
0
 protected static void HandleClientUevent(object o, UeventArgs args)
 {
     Console.WriteLine("Received a {0} signal on {1}", args.Action,
                       (args.Device.HasProperty("ID_VENDOR") ? args.Device.GetProperty("ID_VENDOR") : "nameless device"));
 }
Ejemplo n.º 4
0
 protected static void HandleClientUevent(object o, UeventArgs args)
 {
     Console.WriteLine ("Received a {0} signal on {1}", args.Action,
         (args.Device.HasProperty ("ID_VENDOR") ? args.Device.GetProperty ("ID_VENDOR") : "nameless device"));
 }