public RgbButton(WinUSBEnumeratedDevice dev) { BaseDevice = new WinUSBDevice(dev); ButtonColors = new RGBColor[4]; ButtonValues = new int[4]; ButtonPressed = new bool[4]; BaseDevice.EnableBufferedRead(IN_PIPE); BaseDevice.BufferedReadNotifyPipe(IN_PIPE, NewDataCallback); EnableDisplayTimeout(); EnableButtonData(); }
public HackRF(WinUSBEnumeratedDevice dev) { Device = new WinUSBDevice(dev); SetBufferSettings(512, 128); // 64MB of data ResetBuffers(); // Set a bunch of sane defaults. SetSampleRate(10000000); // 10MHz SetFilterBandwidth(10000000); SetLnaGain(8); SetVgaGain(20); SetTxVgaGain(0); }
public WinUSBDevice(WinUSBEnumeratedDevice deviceInfo) { myDevicePath = deviceInfo.DevicePath; deviceHandle = NativeMethods.CreateFile(myDevicePath, NativeMethods.GENERIC_READ | NativeMethods.GENERIC_WRITE, NativeMethods.FILE_SHARE_READ | NativeMethods.FILE_SHARE_WRITE, IntPtr.Zero, NativeMethods.OPEN_EXISTING, NativeMethods.FILE_ATTRIBUTE_NORMAL | NativeMethods.FILE_FLAG_OVERLAPPED, IntPtr.Zero); if (deviceHandle.IsInvalid) { throw new Exception("Could not create file. " + (new Win32Exception()).ToString()); } if (!NativeMethods.WinUsb_Initialize(deviceHandle, out WinusbHandle)) { WinusbHandle = IntPtr.Zero; throw new Exception("Could not Initialize WinUSB. " + (new Win32Exception()).ToString()); } }
public Fadecandy(WinUSBEnumeratedDevice dev) { BaseDevice = new WinUSBDevice(dev); Pixels = new RGBColor[512]; Initialize(); }
public SeekThermal(WinUSBEnumeratedDevice dev) { device = new WinUSBDevice(dev); // device setup sequence try { device.ControlTransferOut(0x41, 0x54, 0, 0, new byte[] { 0x01 }); } catch { // Try deinit device and repeat. Deinit(); device.ControlTransferOut(0x41, 0x54, 0, 0, new byte[] { 0x01 }); } device.ControlTransferOut(0x41, 0x3c, 0, 0, new byte[] { 0x00, 0x00 }); byte[] data1 = device.ControlTransferIn(0xC1, 0x4e, 0, 0, 4); byte[] data2 = device.ControlTransferIn(0xC1, 0x36, 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, 0x56, 0, 0, new byte[] { 0x20, 0x00, 0x30, 0x00, 0x00, 0x00 }); byte[] data3 = device.ControlTransferIn(0xC1, 0x58, 0, 0, 0x40); device.ControlTransferOut(0x41, 0x56, 0, 0, new byte[] { 0x20, 0x00, 0x50, 0x00, 0x00, 0x00 }); byte[] data4 = device.ControlTransferIn(0xC1, 0x58, 0, 0, 0x40); device.ControlTransferOut(0x41, 0x56, 0, 0, new byte[] { 0x0C, 0x00, 0x70, 0x00, 0x00, 0x00 }); byte[] data5 = device.ControlTransferIn(0xC1, 0x58, 0, 0, 0x18); device.ControlTransferOut(0x41, 0x56, 0, 0, new byte[] { 0x06, 0x00, 0x08, 0x00, 0x00, 0x00 }); byte[] data6 = device.ControlTransferIn(0xC1, 0x58, 0, 0, 0x0c); device.ControlTransferOut(0x41, 0x3E, 0, 0, new byte[] { 0x08, 0x00 }); byte[] data7 = device.ControlTransferIn(0xC1, 0x3D, 0, 0, 2); device.ControlTransferOut(0x41, 0x3E, 0, 0, new byte[] { 0x08, 0x00 }); device.ControlTransferOut(0x41, 0x3C, 0, 0, new byte[] { 0x01, 0x00 }); byte[] data8 = device.ControlTransferIn(0xC1, 0x3D, 0, 0, 2); }
public Ubertooth(WinUSBEnumeratedDevice dev) { Device = new WinUSBDevice(dev); }
public SignTest(WinUSBEnumeratedDevice deviceInfo) { Device = new WinUSBDevice(deviceInfo); }