USB Audio 2.0 Drivers - Windows drivers
Driver on

Usbsamp Generic USB Driver – Code Samples

The USBSAMP pattern demonstrates how you can carry out full velocity, excessive velocity, and SuperSpeed transfers to and from bulk and isochronous endpoints of a generic USB gadget. USBSAMP is predicated on the Kernel Mode Driver Framework (KMDF). Superspeed bulk and isochronous transfers solely work when the Microsoft USB 3.Zero stack is loaded.

The pattern additionally comprises a console check utility that initiates bulk (together with stream) and isochronous transfers and obtains knowledge from the gadget’s I/O endpoints. The appliance additionally demonstrates how you can use GUID-based gadget names and pipe names generated by the working system utilizing the SetupDiXXX user-mode APIs.

For details about USB, see Common Serial Bus (USB) Drivers.

Common Home windows Driver Compliant

This pattern builds a Common Home windows Driver. It makes use of solely APIs and DDIs which can be included in OneCoreUAP.

{Hardware} necessities

The pattern driver might be loaded because the operate driver for any of those units:

When you have a special USB gadget, you may nonetheless use the motive force by including the gadget’s {hardware} ID to the INX file. Observe that the info switch eventualities will work solely with the endpoints supported by the gadget.

Set the configuration and platform in Visible Studio

In Visible Studio, in Answer Explorer, proper click on Answer ‘usbsamp’ (Three tasks), and select Configuration Supervisor. Set the configuration and the platform. Ensure that the configuration and platform are the identical for each the motive force venture and the bundle venture. Don’t test the Deploy containers.

Construct the pattern utilizing Visible Studio

In Visible Studio, on the Construct menu, select Construct Answer.

For extra details about utilizing Visible Studio to construct a driver bundle, see Constructing a Driver with Visible Studio and the WDK.

Find the constructed driver

In File Explorer, navigate to the folder that comprises your constructed driver bundle. The situation of this folder varies relying on what you set for configuration and platform. For instance, in case your settings are Debug and x64, the motive force is in your answer folder below sysdriverDebugusbsamp.

The driving force folder comprises these recordsdata:

File Description
usbsamp.sys The driving force file
usbsamp.inf An data (INF) file that comprises data wanted to put in the motive force.
kmdfsamples.cat A signed catalog file, which serves because the signature for the whole bundle.

Run the pattern

The pc the place you put in the motive force is named the goal laptop or the check laptop. Usually it is a separate laptop from the place you develop and construct the motive force bundle. The pc the place you develop and construct the motive force is named the host laptop.

The method of shifting the motive force bundle to the goal laptop and putting in the motive force is named deploying the motive force. You may deploy the USBSAMP pattern routinely or manually.

Automated deployment

Earlier than you routinely deploy a driver, you will need to provision the goal laptop. For directions, see Provision a pc for driver deployment and testing (WDK 10).

  1. On the host laptop, in Visible Studio, in Answer Explorer, proper click on bundle (decrease case), and select Properties. Navigate to Configuration Properties > Driver Set up > Deployment.

  2. Verify Allow deployment, and test Take away earlier driver variations earlier than deployment. For Goal Laptop Title, choose the title of a goal laptop that you just provisioned beforehand. Choose Set up and Confirm. Click on OK.

  3. On the Construct menu, select Deploy Bundle or Construct Answer.

Handbook deployment

Earlier than you manually deploy a driver, you will need to activate check signing and set up a certificates on the goal laptop. You additionally want to repeat the DevCon instrument to the goal laptop. For directions, see Getting ready a Laptop for Handbook Driver Deployment.

  1. Copy the entire recordsdata in your driver bundle to a folder on the goal laptop (for instance, c:Usbsamp).

  2. On the goal laptop, open a Command Immediate window as Administrator. Navigate to your driver bundle folder, and enter the next command:

    devcon set up usbsamp.inf USBVID_045E&PID_078F

View the gadget in Machine Supervisor

On the goal laptop, in a Command Immediate window, enter devmgmt to open Machine Supervisor. In Machine Supervisor, on the View menu, select Units by sort. Within the gadget tree, find the gadget. For instance the gadget title is likely to be WDF Pattern for FX2 MUTT gadget below thePattern Machine node.

Construct the pattern utilizing MSBuild

As an alternative choice to constructing the USBSAMP pattern in Visible Studio, you may construct it in a Visible Studio Command Immediate window. In Visible Studio, on the Instruments menu, select Visible Studio Command Immediate. Within the Visible Studio Command Immediate window, navigate to the folder that has the answer file, Usbsamp.sln. Use the MSBuild command to construct the answer. Listed below are some examples:

`msbuild /p:configuration="Debug" /p:platform="x64" Usbsamp.sln`

`msbuild /p:configuration="Launch" /p:platform="Win32" Usbsamp.sln`

For extra details about utilizing MSBuild to construct a driver bundle, see Constructing a Driver with Visible Studio and the WDK.

Testing the pattern

The pattern features a check utility, usbsamp.exe. This console utility enumerates the interface registered by the motive force and opens the gadget to ship Learn, Write, or DeviceIoControl requests primarily based on the command line choices. To check the pattern,

  1. In Visible Studio, select Answer Explorer from the View menu. Find the appliance venture named usbsamp, below the Exe folder.

  2. Proper-click and select Construct. For instance, in case your settings are Debug and x64, the appliance executable is in your answer folder below the exeDebugusbsamp.exe.

  3. Run the executable on the goal machine.

  • To view all descriptors and endpoint data, use the next command.

    usbsamp.exe -u

    You should use the previous command to view pipe numbers for learn and write requests.

  • To ship a Learn-Write request, use the next command.

    usbsamp.exe -r 1024 -w 1024 -c 100 -v

    The previous command first writes 1024 bytes of knowledge to bulk out endpoint (pipe 1), then reads 1024 bytes from bulk in endpoint (pipe 0), and compares the learn buffer with write buffer to see in the event that they match. If the buffer contents match, it performs this operation 100 instances.

  • To ship Learn-Write requests to bulk endpoints, use any of the next instructions, concurrently. If Learn-Write requests are despatched to a SuperSpeed bulk endpoint with streams, the pattern driver all the time makes use of the primary underlying stream related to that endpoint. The driving force is multi-thread secure so it might deal with a number of requests at a time.

    usbsamp.exe -r 65536

    The previous command reads 65536 bytes from pipe 0.

    usbsamp.exe -w 65536

    The previous command writes 65536 bytes to pipe 1.

    usbsamp.exe -r 65536 -i pipe02

    The previous command reads 65536 bytes from pipe 2.

    usbsamp.exe -w 65536 -o pipe03

    The previous command writes 65536 bytes to pipe 3.

  • To ship Learn and Write requests to isochronous endpoints you need to use a number of of those instructions concurrently.

    usbsamp.exe -r 512 -i pipe04

    The previous command reads 512 bytes from pipe 4.

    usbsamp.exe -w 512 -o pipe05

    The previous command writes 512 bytes to pipe 5.

    usbsamp.exe -w 1024 -o pipe05 -r 1024 -i pipe04 -c 100 -v

    The previous command writes 1024 bytes to pipe 5, then reads 1024 bytes from pipe 4, and compares the buffers to see in the event that they match. If the buffer contents match, it performs this operation 100 instances.

  • To skip validation of the info to be learn or written in a selected request, use the command with -x choice as follows:

    usbsamp.exe -r 1024 -w 1024 -c 100 -x

Leave a Reply

Your email address will not be published. Required fields are marked *