示例#1
0
        private void GetHandle()
        {
            usb_fs = null;
            #if MONO
            usb_port = new USBWrapper_Posix();
            usb_report_size = 64;
            #else
            usb_port = new USBWrapper_Win32();
            usb_report_size = 65;
            #endif
            while(usb_fs == null){
            usb_fs = usb_port.GetUSBHandle(usb_devicefile,usb_report_size);
            if (usb_fs == null){
                if (this.verbose_mode > 0)
                    System.Console.WriteLine("No device");
                System.Threading.Thread.Sleep(5000);
            }
            else {
                if (this.verbose_mode > 0)
                    System.Console.WriteLine("USB device found");
            }

            }
        }
 public override void Read()
 {
     #if MONO
     usb_port = new USBWrapper_Posix();
     usb_report_size = 64;
     #else
     usb_port = new USBWrapper_Win32();
     usb_report_size = 65;
     #endif
     usb_fs = usb_port.GetUSBHandle(usb_devicefile,usb_report_size);
     if (usb_fs == null)
     System.Console.WriteLine("No device");
     else
     System.Console.WriteLine("USB device found");
     SendReport(BuildCommand(LcdSetBacklightTimeout(0)));
     SetStateStart();
     ReRead();
     //SetStateCardType();
 }
示例#3
0
 protected virtual void GetHandle()
 {
     usb_fs = null;
     usb_port = new USBWrapper_HidSharp();
     System.Console.WriteLine("  USB Layer: HidSharp");
     usb_report_size = 65;
     while (usb_fs == null) {
         usb_fs = usb_port.GetUSBHandle(usb_devicefile,usb_report_size);
         if (usb_fs == null) {
             if (this.verbose_mode > 0) {
                 System.Console.WriteLine("No device");
             }
             System.Threading.Thread.Sleep(5000);
         } else { 
             if (this.verbose_mode > 0) {
                 System.Console.WriteLine("USB device found");
             }
         }
     }
 }
示例#4
0
    private void GetHandle()
    {
        usb_fs = null;
        usb_report_size = 32;

        /** prebuild ack and nack messages */
        nack = new byte[usb_report_size];
        ack = new byte[usb_report_size];
        nack[0] = 0x2;
        nack[1] = 0x1;
        nack[2] = 0x15;
        ack[0] = 0x2;
        ack[1] = 0x1;
        ack[2] = 0x6;
        for (int i=3; i<usb_report_size; i++) {
            nack[i] = 0;
            ack[i] = 0;
        }

        usb_port = new USBWrapper_HidSharp();
        while(usb_fs == null){
            usb_fs = usb_port.GetUSBHandle(usb_devicefile,usb_report_size);
            if (usb_fs == null){
                if (this.verbose_mode > 0)
                    System.Console.WriteLine("No device");
                System.Threading.Thread.Sleep(5000);
            }
            else {
                if (this.verbose_mode > 0)
                    System.Console.WriteLine("USB device found");
            }
        }
        //AsyncRead();
    }
示例#5
0
 public override void Read()
 {
     #if MONO
     usb_port = new USBWrapper_Posix();
     usb_report_size = 64;
     #else
     usb_port = new USBWrapper_Win32();
     usb_report_size = 65;
     #endif
     usb_fs = usb_port.GetUSBHandle(usb_devicefile,usb_report_size);
     if (usb_fs == null)
     System.Console.WriteLine("No device");
     else
     System.Console.WriteLine("USB device found");
     byte[] version = BuildCommand(new byte[]{0x78,0x46,0x01});
     SendReport(version);
     ReRead();
 }