Beispiel #1
0
        static MouseDescriptors()
        {
            _relativeHid = UsbDescriptors.CommonHid;
            _relativeHid.dev_hid.wRPDescriptorLength = (short)RelativeReport.Length;

            _absoluteHid = UsbDescriptors.CommonHid;
            _absoluteHid.dev_hid.wRPDescriptorLength = (short)AbsoluteReport.Length;

            _absoluteAndRelativeHid = UsbDescriptors.CommonHid;
            _absoluteAndRelativeHid.dev_hid.wRPDescriptorLength = (short)AbsoluteAndRelativeReport.Length;
        }
Beispiel #2
0
 public Usbip(USB_DEVICE_DESCRIPTOR desc, CONFIG_HID configuration_hid, byte [] report_descriptor)
 {
     _desc = desc;
     _configuration_hid = configuration_hid;
     _report_descriptor = report_descriptor;
 }
Beispiel #3
0
        unsafe int handle_get_descriptor(Socket clntSocket, USB_DEVICE_DESCRIPTOR desc, CONFIG_HID configuration_hid, StandardDeviceRequest control_req, USBIP_RET_SUBMIT usb_req)
        {
            int handled = 0;

            TraceLog($"handle_get_descriptor {control_req.wValue1} [{control_req.wValue0}]");
            if (control_req.wValue1 == 0x1) // Device
            {
                TraceLog("Device");
                handled = 1;

                byte [] buf = StructureToBytes(desc);
                send_usb_req(clntSocket, usb_req, buf, (uint)sizeof(USB_DEVICE_DESCRIPTOR) /*control_req->wLength*/, 0);
            }
            if (control_req.wValue1 == 0x2) // configuration
            {
                TraceLog("Configuration\n");
                handled = 1;
                byte[] buf = StructureToBytes(configuration_hid);
                send_usb_req(clntSocket, usb_req, buf, (uint)control_req.wLength, 0);
            }
            if (control_req.wValue1 == 0x3) // string
            {
                /*
                 * byte [] str = new byte[255];
                 * int i;
                 * for (i = 0; i < (*strings[control_req->wValue0] / 2) - 1; i++)
                 *  str[i] = strings[control_req->wValue0][i * 2 + 2];
                 * Console.WriteLine("String (%s)\n", str);
                 * handled = 1;
                 * send_usb_req(clntSocket, usb_req, (char*)strings[control_req->wValue0], *strings[control_req->wValue0], 0);
                 */
            }
            if (control_req.wValue1 == 0x6) // qualifier
            {
                TraceLog("Qualifier");
                handled = 1;
                byte[] buf = StructureToBytes(dev_qua);
                send_usb_req(clntSocket, usb_req, buf, (uint)control_req.wLength, 0);
            }
            if (control_req.wValue1 == 0xA) // config status ???
            {
                TraceLog("Unknow");
                handled = 1;
                send_usb_req(clntSocket, usb_req, null, 0, 1);
            }
            return(handled);
        }
Beispiel #4
0
 static KeyboardMouseDescriptors()
 {
     _hid = UsbDescriptors.CommonHid;
     _hid.dev_hid.wRPDescriptorLength = (short)Report.Length;
 }