Example #1
0
        public static Task <USBDevice> ClaimInterface(this USBDevice device, USBInterface usbInterface)
        {
            if (usbInterface == null)
            {
                throw new ArgumentNullException(nameof(usbInterface));
            }

            return(device.ClaimInterface(usbInterface.InterfaceNumber));
        }
Example #2
0
        public static Task <USBDevice> ClaimBulkInterface(this USBDevice device)
        {
            var bulkInterface = device.Configuration.Interfaces.FirstOrDefault(i => i.Alternates.Any(a => a.Endpoints.Any(e => e.Type == USBEndpointType.Bulk)));

            if (bulkInterface == null)
            {
                throw new InvalidOperationException("This devices doesn't have a Bulk interface");
            }
            return(device.ClaimInterface(bulkInterface.InterfaceNumber));
        }