public void OnDescriptorRequested(DescriptorRequestedEventArgs e)
 {
     switch ((e.wValue >> 8) & 0xFF)
       {
     case 0x01: //Device descriptor
       {
     e.DescriptorData = new byte[] { 0x12, 0x01, 0x00, 0x02, 0x08, 0x06, 0x50, 0x40,
       (byte)(_vendorId & 0xFF), (byte)((_vendorId >> 8) & 0xFF),
       (byte)(_productId & 0xFF), (byte)((_productId >> 8) & 0xFF),
       0x00, 0x01, 0x00, 0x00, 0x00, 0x01 };
     break;
       }
     case 0x02: //Configuration descriptor
       {
     e.DescriptorData = new byte[] { 0x09, 0x02, 0x20, 0x00, 0x01, 0x01, 0x00, 0xE0, 0xFA, 0x09, 0x04, 0x00, 0x00, 0x02, 0x08, 0x06, 0x50, 0x00,
                             0x07, 0x05, 0x81, 0x02, 0x40, 0x00, 0x00, 0x07, 0x05, 0x02, 0x02, 0x40, 0x00, 0x00 };
     break;
       }
     default:
       {
     //Uh?
     break;
       }
       }
 }
        public void OnDescriptorRequested(DescriptorRequestedEventArgs e)
        {
            switch ((e.wValue >> 8) & 0xFF)
            {
            case 0x01: //Device descriptor
            {
                e.DescriptorData = new byte[] { 0x12, 0x01, 0x00, 0x02, 0x08, 0x06, 0x50, 0x40,
                                                (byte)(_vendorId & 0xFF), (byte)((_vendorId >> 8) & 0xFF),
                                                (byte)(_productId & 0xFF), (byte)((_productId >> 8) & 0xFF),
                                                0x00, 0x01, 0x00, 0x00, 0x00, 0x01 };
                break;
            }

            case 0x02: //Configuration descriptor
            {
                e.DescriptorData = new byte[] { 0x09, 0x02, 0x20, 0x00, 0x01, 0x01, 0x00, 0xE0, 0xFA, 0x09, 0x04, 0x00, 0x00, 0x02, 0x08, 0x06, 0x50, 0x00,
                                                0x07, 0x05, 0x81, 0x02, 0x40, 0x00, 0x00, 0x07, 0x05, 0x02, 0x02, 0x40, 0x00, 0x00 };
                break;
            }

            default:
            {
                //Uh?
                break;
            }
            }
        }
Beispiel #3
0
        public void OnDescriptorRequested(DescriptorRequestedEventArgs e)
        {
            switch ((e.wValue >> 8) & 0xFF)
            {
            case 0x01: //Device descriptor
            {
                e.DescriptorData = new byte[] { 0x12, 0x01, 0x00, 0x02, 0x00, 0x00, 0x00, 0x40, 0x03, 0x04, 0x01, 0x60, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01 };
                break;
            }

            case 0x02: //Configuration descriptor
            {
                e.DescriptorData = new byte[] { 0x09, 0x02, 0x20, 0x00, 0x01, 0x01, 0x00, 0xA0, 0x32, 0x09, 0x04, 0x00, 0x00, 0x02, 0xFF, 0xFF, 0xFF, 0x00,
                                                0x07, 0x05, 0x83, 0x03, 0x0A, 0x00, 0x01, 0x07, 0x05, 0x01, 0x02, 0x40, 0x00, 0x00 };

                break;
            }

            default:
            {
                //Uh?
                break;
            }
            }
        }
Beispiel #4
0
        public void OnDescriptorRequested(DescriptorRequestedEventArgs e)
        {
            //Issue the request to the real device, and return whatever it did
            var setup = new UsbSetupPacket((byte)0x80, (byte)0x06,
                                           (short)e.wValue, (short)e.wIndex, 0x0FFF);
            int transferred;

            var ret = new byte[0x0FFF];

            _forwardee.ControlTransfer(ref setup, ret, ret.Length, out transferred);
            e.DescriptorData = new byte[transferred];
            Array.Copy(ret, 0, e.DescriptorData, 0, e.DescriptorData.Length);
        }
Beispiel #5
0
        public void OnDescriptorRequested(DescriptorRequestedEventArgs e)
        {
            switch ((e.wValue >> 8) & 0xFF)
            {
            case 0x01: //Device descriptor
            {
                e.DescriptorData = new byte[] { 0x12, 0x01, 0x00, 0x02, 0x00, 0x00, 0x00, 0x40,
                                                (byte)(_vendorId & 0xFF), (byte)((_vendorId >> 8) & 0xFF),
                                                (byte)(_productId & 0xFF), (byte)((_productId >> 8) & 0xFF),
                                                0x01, 0x00, 0x00, 0x00, 0x00, 0x01 };
                break;
            }

            case 0x02: //Configuration descriptor
            {
                e.DescriptorData = new byte[] { 0x09, 0x02, 0x00, 0x00, 0x01, 0x01, 0x00, 0x80, 0x96, 0x09, 0x04, 0x00, 0x00, 0x01, 0x03, 0x01, 0x01, 0x00, 0x09,
                                                0x21, 0x10, 0x01, 0x00, 0x01, 0x22, 0x40, 0x00, 0x07, 0x05, 0x81, 0x03, 0x08, 0x00, 0x20 };

                //Calculate the size
                e.DescriptorData[2] = (byte)(e.DescriptorData.Length & 0xFF);
                e.DescriptorData[3] = (byte)((e.DescriptorData.Length >> 8) & 0xFF);

                break;
            }

            case 0x22: //HID report descriptor
            {
                e.DescriptorData = new byte[] { 0x05, 0x01, 0x09, 0x06, 0xA1, 0x01, 0x05, 0x07, 0x19, 0xE0, 0x29, 0xE7, 0x15, 0x00, 0x25, 0x01,
                                                0x75, 0x01, 0x95, 0x08, 0x81, 0x02, 0x95, 0x01, 0x75, 0x08, 0x81, 0x01, 0x95, 0x05, 0x75, 0x01, 0x05, 0x08, 0x19, 0x01, 0x29,
                                                0x05, 0x91, 0x02, 0x95, 0x01, 0x75, 0x03, 0x91, 0x01, 0x95, 0x06, 0x75, 0x08, 0x15, 0x00, 0x26, 0xA4, 0x00, 0x05, 0x07, 0x19,
                                                0x00, 0x29, 0xA4, 0x81, 0x00, 0xC0 };
                break;
            }

            default:
            {
                //Uh?
                break;
            }
            }
        }
        public void OnDescriptorRequested(DescriptorRequestedEventArgs e)
        {
            //Issue the request to the real device, and return whatever it did
              var setup = new UsbSetupPacket((byte)0x80, (byte)0x06,
            (short)e.wValue, (short)e.wIndex, 0x0FFF);
              int transferred;

              var ret = new byte[0x0FFF];
              _forwardee.ControlTransfer(ref setup, ret, ret.Length, out transferred);
              e.DescriptorData = new byte[transferred];
              Array.Copy(ret, 0, e.DescriptorData, 0, e.DescriptorData.Length);
        }
        public void OnDescriptorRequested(DescriptorRequestedEventArgs e)
        {
            switch ((e.wValue >> 8) & 0xFF)
              {
            case 0x01: //Device descriptor
              {
            e.DescriptorData = new byte[] { 0x12, 0x01, 0x00, 0x02, 0x00, 0x00, 0x00, 0x40,
              (byte)(_vendorId & 0xFF), (byte)((_vendorId >> 8) & 0xFF),
              (byte)(_productId & 0xFF), (byte)((_productId >> 8) & 0xFF),
              0x01, 0x00, 0x00, 0x00, 0x00, 0x01 };
            break;
              }
            case 0x02: //Configuration descriptor
              {
            e.DescriptorData = new byte[] { 0x09, 0x02, 0x00, 0x00, 0x01, 0x01, 0x00, 0x80, 0x96, 0x09, 0x04, 0x00, 0x00, 0x01, 0x03, 0x01, 0x01, 0x00, 0x09,
            0x21, 0x10, 0x01, 0x00, 0x01, 0x22, 0x40, 0x00, 0x07, 0x05, 0x81, 0x03, 0x08, 0x00, 0x20};

            //Calculate the size
            e.DescriptorData[2] = (byte)(e.DescriptorData.Length & 0xFF);
            e.DescriptorData[3] = (byte)((e.DescriptorData.Length >> 8) & 0xFF);

            break;
              }
            case 0x22: //HID report descriptor
              {
            e.DescriptorData = new byte[] { 0x05, 0x01, 0x09, 0x06, 0xA1, 0x01, 0x05, 0x07, 0x19, 0xE0, 0x29, 0xE7, 0x15, 0x00, 0x25, 0x01,
            0x75, 0x01, 0x95, 0x08, 0x81, 0x02, 0x95, 0x01, 0x75, 0x08, 0x81, 0x01, 0x95, 0x05, 0x75, 0x01, 0x05, 0x08, 0x19, 0x01, 0x29,
            0x05, 0x91, 0x02, 0x95, 0x01, 0x75, 0x03, 0x91, 0x01, 0x95, 0x06, 0x75, 0x08, 0x15, 0x00, 0x26, 0xA4, 0x00, 0x05, 0x07, 0x19,
            0x00, 0x29, 0xA4, 0x81, 0x00, 0xC0 };
            break;
              }
            default:
              {
            //Uh?
            break;
              }
              }
        }