public static List <string> GetAllDevices() { var ret = new List <string>(); var candidates = HIDDevice.GetAllDevices(_VENDOR_ID, _PRODUCT_ID1); foreach (var c in HIDDevice.GetAllDevices(_VENDOR_ID, _PRODUCT_ID2)) { candidates.Add(c); } foreach (var device in candidates) { var d = new WiiInputDevice(device, null); Thread.Sleep(1000); bool found = d.ExtensionType.HasValue && d.ExtensionType.Value == 0xFF00A4200112; d.Disconnect(); d.Dispose(); d = null; if (found) { ret.Add(device); } } return(ret); }
public static bool IsDetected(int vendorId, int productId) { var device = new HIDDevice(vendorId, productId, false); bool ret = device.Found; device.Dispose(); return ret; }
public static bool IsDetected(int vendorId, int productId) { var device = new HIDDevice(vendorId, productId, false); bool ret = device.Found; device.Dispose(); return(ret); }
public PS3uDrawTabletDevice() { ButtonState = new TabletButtonState(); DPadState = new TabletDPadState(); UnknownData1 = new byte[_UNKNOWN_DATA1_SIZE]; AccelerometerData = new TabletAccelerometerData(); _device = new HIDDevice(_VENDOR_ID, _PRODUCT_ID); _device.DataReceived += _device_DataReceived; }
private unsafe void _Init(int vendorId, int productId, bool throwNotFoundError) { var devices = HIDDevice.GetAllDevices(vendorId, productId); if (devices != null && devices.Count > 0) { _Init(devices[0], throwNotFoundError); } else { if (throwNotFoundError) { throw new InvalidOperationException("Device not found"); } } }
public WiiInputDevice(string devicePath, int? index) { ButtonState = new TabletButtonState(); DPadState = new TabletDPadState(); AccelerometerData = new TabletAccelerometerData(); _acknowledgements = new Dictionary<byte, int>(); _device = new HIDDevice(devicePath); //Initialize the device Index = index; _device.DataReceived += _device_DataReceived; if (index.HasValue) { EnableLEDs(index.Value == 0, index.Value == 1, index.Value == 2, index.Value == 3); } //Get the initial status _lastReportingMode = 0x37; RefreshStatus(); }
public WiiInputDevice(string devicePath, int?index) { ButtonState = new TabletButtonState(); DPadState = new TabletDPadState(); AccelerometerData = new TabletAccelerometerData(); _acknowledgements = new Dictionary <byte, int>(); _device = new HIDDevice(devicePath); //Initialize the device Index = index; _device.DataReceived += _device_DataReceived; if (index.HasValue) { EnableLEDs(index.Value == 0, index.Value == 1, index.Value == 2, index.Value == 3); } //Get the initial status _lastReportingMode = 0x37; RefreshStatus(); }
/// <summary> /// Detects whether the PS3 uDraw tablet device is currently attached to the PC. /// This is only detecting the presence of the USB dongle, NOT whether it is sync'd with the tablet. /// I don't know how to do that. /// </summary> /// <returns></returns> public static bool IsDetected() { return(HIDDevice.IsDetected(_VENDOR_ID, _PRODUCT_ID)); }