Esempio n. 1
0
        public Form1()
        {
            InitializeComponent();
            logger.Info("Trying to connect to device with GUID: {0}", deviceGUID.ToString());
            if (USBDevice.GetDevices(deviceGUID).Count() > 0)
            {
                try
                {
                    device = USBDevice.GetSingleDevice(deviceGUID);
                }catch (USBException ex)
                {
                    logger.Warn("Something went wrong connecting to device", ex);
                }
            }

            connectionNotifier = new USBNotifier(this, deviceGUID); //setup connection and disconnection Notifier
            if (device == null)
            {
                logger.Warn("No Device found");
            }
            else
            {
                logger.Info("Connected to device");
                logDeviceiFaceProperties(device);
            }
            connectionNotifier.Arrival += ConnectionNotifier_Arrival;
            connectionNotifier.Removal += ConnectionNotifier_Removal;
        }
Esempio n. 2
0
 public void SetupUSBNotifier(Control control)
 {
     notifier          = new USBNotifier(control, guid);
     notifier.Removal += USBEventHandler;
     notifier.Arrival += USBEventHandler;
     control.Select();
 }
        protected override void Initialize()
        {
            winUsbForm               = new Form();
            notifier                 = new USBNotifier(winUsbForm, guid);
            winUsbForm.Name          = "WinUSB form";
            notifier.Arrival        += OnDeviceArrival;
            notifier.Removal        += OnDeviceRemoval;
            winUsbForm.Size          = new System.Drawing.Size(0, 0);
            winUsbForm.WindowState   = FormWindowState.Minimized;
            winUsbForm.ShowInTaskbar = false;
            winUsbForm.Enabled       = false;
            winUsbForm.Show();
            winUsbForm.Visible = false;
            USBDeviceInfo[] usbDeviceList = USBDevice.GetDevices(guid);
            C.Logger.Debug("Total number of Win USB devices attached: " + usbDeviceList.Length.ToString());
            foreach (USBDeviceInfo device in usbDeviceList)
            {
                string sAdd = string.Format("Vid:0x{0:X4} Pid:0x{1:X4} (dsc:{2}) - path:{3}",
                                            device.VID,
                                            device.PID,
                                            device.DeviceDescription, device.DevicePath);

                C.Logger.Debug(sAdd);
            }
        }
Esempio n. 4
0
        public WebCamHardwareScanner()
        {
            WebCamHardwareScannerForm frm = new WebCamHardwareScannerForm();
            Guid webcamGUID = new Guid("6994ad05-93ef-11d0-a3cc-00a0c9223196");

            notifier = new USBNotifier(frm, webcamGUID);


            frm.Show();
        }
Esempio n. 5
0
        internal void Start()
        {
            LumiaOldCombiNotifier          = new USBNotifier(OldCombiInterfaceGuid);
            LumiaOldCombiNotifier.Arrival += LumiaNotifier_Arrival;
            LumiaOldCombiNotifier.Removal += LumiaNotifier_Removal;

            LumiaNewCombiNotifier          = new USBNotifier(NewCombiInterfaceGuid);
            LumiaNewCombiNotifier.Arrival += LumiaNotifier_Arrival;
            LumiaNewCombiNotifier.Removal += LumiaNotifier_Removal;

            LumiaNormalNotifier          = new USBNotifier(LumiaNormalInterfaceGuid);
            LumiaNormalNotifier.Arrival += LumiaNotifier_Arrival;
            LumiaNormalNotifier.Removal += LumiaNotifier_Removal;

            LumiaFlashNotifier          = new USBNotifier(LumiaFlashInterfaceGuid);
            LumiaFlashNotifier.Arrival += LumiaNotifier_Arrival;
            LumiaFlashNotifier.Removal += LumiaNotifier_Removal;

            StorageNotifier          = new USBNotifier(MassStorageInterfaceGuid);
            StorageNotifier.Arrival += LumiaNotifier_Arrival;
            StorageNotifier.Removal += LumiaNotifier_Removal;

            ComPortNotifier          = new USBNotifier(ComPortInterfaceGuid);
            ComPortNotifier.Arrival += LumiaNotifier_Arrival;
            ComPortNotifier.Removal += LumiaNotifier_Removal;

            LumiaEmergencyNotifier          = new USBNotifier(LumiaEmergencyInterfaceGuid);
            LumiaEmergencyNotifier.Arrival += LumiaNotifier_Arrival;
            LumiaEmergencyNotifier.Removal += LumiaNotifier_Removal;

            LumiaLabelNotifier          = new USBNotifier(LumiaLabelInterfaceGuid);
            LumiaLabelNotifier.Arrival += LumiaNotifier_Arrival;
            LumiaLabelNotifier.Removal += LumiaNotifier_Removal;

            HidInterfaceNotifier          = new USBNotifier(HidInterfaceGuid);
            HidInterfaceNotifier.Arrival += LumiaNotifier_Arrival;
            HidInterfaceNotifier.Removal += LumiaNotifier_Removal;

            try
            {
                EventLogQuery LogQuery = new EventLogQuery("Microsoft-Windows-Kernel-PnP/Configuration", PathType.LogName, "*[System[(EventID = 411)]]");
                LogWatcher = new EventLogWatcher(LogQuery);
                LogWatcher.EventRecordWritten += new EventHandler <EventRecordWrittenEventArgs>(PnPEventWritten);
                LogWatcher.Enabled             = true;
                App.IsPnPEventLogMissing       = false;
            }
            catch { }
        }