Пример #1
0
        //! Custom vendor requests that must be implemented in the benchmark firmware.


        #region Public Members
        public static bool Configure(UsbK usb,
                                     BM_COMMAND command,
                                     byte interfaceNumber,
                                     ref BM_TEST_TYPE testType)
        {
            int transferred;
            WINUSB_SETUP_PACKET pkt;

            byte[] data = new byte[1];

            pkt.RequestType = (1 << 7) | (2 << 5);
            pkt.Request     = (byte)command;

            pkt.Value  = (ushort)testType;
            pkt.Index  = interfaceNumber;
            pkt.Length = 1;

            bool success = usb.ControlTransfer(pkt,
                                               Marshal.UnsafeAddrOfPinnedArrayElement(data,
                                                                                      0),
                                               1,
                                               out transferred,
                                               IntPtr.Zero);

            testType = (BM_TEST_TYPE)data[0];
            return(success);
        }
Пример #2
0
        //! Custom vendor requests that must be implemented in the benchmark firmware.


        #region Public Members
        public static bool Configure(UsbK usb,
                                     BM_COMMAND command,
                                     byte interfaceNumber,
                                     ref BM_TEST_TYPE testType)
        {
            int transferred;
            WINUSB_SETUP_PACKET pkt;
            byte[] data = new byte[1];

            pkt.RequestType = (1 << 7) | (2 << 5);
            pkt.Request = (byte) command;

            pkt.Value = (ushort) testType;
            pkt.Index = interfaceNumber;
            pkt.Length = 1;

            bool success = usb.ControlTransfer(pkt,
                                               Marshal.UnsafeAddrOfPinnedArrayElement(data,
                                                                                      0),
                                               1,
                                               out transferred,
                                               IntPtr.Zero);
            testType = (BM_TEST_TYPE) data[0];
            return success;
        }