Example #1
0
        void VendorRequestOut(DeviceRequest request, ushort value, ushort index, byte[] data)
        {
            byte requestType = WinUSBDevice.ControlRecipientDevice | WinUSBDevice.ControlTypeVendor;

            Device.ControlTransferOut(requestType, (byte)request, value, index, data);
        }
 //
 public void Deinit()
 {
     device.ControlTransferOut(0x41, 0x3C, 0, 0, new byte[] { 0x00, 0x00 });
     device.ControlTransferOut(0x41, 0x3C, 0, 0, new byte[] { 0x00, 0x00 });
     device.ControlTransferOut(0x41, 0x3C, 0, 0, new byte[] { 0x00, 0x00 });
 }
Example #3
0
 void DfuOut(DfuRequest req, UInt16 value, byte[] data)
 {
     BaseDevice.ControlTransferOut(WinUSBDevice.ControlTypeClass | WinUSBDevice.ControlRecipientInterface, (byte)req, value, DfuInterface, data);
 }
Example #4
0
        public SeekThermalPro(WinUSBEnumeratedDevice dev)
        {
            device = new WinUSBDevice(dev);

            // device setup sequence
            try
            {
                device.ControlTransferOut(0x41, 84, 0, 0, new byte[] { 0x01 });
            }
            catch
            {
                // Try deinit device and repeat.
                Deinit();
                device.ControlTransferOut(0x41, 84, 0, 0, new byte[] { 0x01 });
            }

            device.ControlTransferOut(0x41, 60, 0, 0, new byte[] { 0x00, 0x00 });

            byte[] data1 = device.ControlTransferIn(0xC1, 78, 0, 0, 4);

            byte[] data2 = device.ControlTransferIn(0xC1, 54, 0, 0, 12);

            // Analysis of 0x56 payload:
            // First byte seems to be half the size of the output data.
            // It seems like this command may be retriving some sensor data?
            device.ControlTransferOut(0x41, 86, 0, 0, new byte[] { 0x06, 0x00, 0x08, 0x00, 0x00, 0x00 });

            byte[] data3 = device.ControlTransferIn(0xC1, 0x58, 0, 0, 12);

            device.ControlTransferOut(0x41, 85, 0, 0, new byte[] { 0x17, 0x00 });

            byte[] data4 = device.ControlTransferIn(0xC1, 78, 0, 0, 0x40);

            device.ControlTransferOut(0x41, 86, 0, 0, new byte[] { 0x0C, 0x00, 0x70, 0x00, 0x00, 0x00 });

            byte[] data5 = device.ControlTransferIn(0xC1, 0x58, 0, 0, 2);

            device.ControlTransferOut(0x41, 86, 0, 0, new byte[] { 0x01, 0x00, 0x01, 0x06, 0x00, 0x00 });

            byte[] data6 = device.ControlTransferIn(0xC1, 88, 0, 0, 2);


            UInt16 addr;

            for (addr = 0; addr < 2560; addr += 32)
            {
                byte[] addrle_p = BitConverter.GetBytes(addr);
                device.ControlTransferOut(0x41, 86, 0, 0, new byte[] { 0x20, 0x00, addrle_p[0], addrle_p[1], 0x00, 0x00 });

                byte[] data7 = device.ControlTransferIn(0xC1, 88, 0, 0, 64);
            }

            device.ControlTransferOut(0x41, 85, 0, 0, new byte[] { 0x15, 0x00 });

            byte[] data8 = device.ControlTransferIn(0xC1, 78, 0, 0, 64);

            device.ControlTransferOut(0x41, 62, 0, 0, new byte[] { 0x08, 0x00 });

            device.ControlTransferOut(0x41, 60, 0, 0, new byte[] { 0x01, 0x00 });
        }