10 minutes to complete a USB driver

Source: Internet
Author: User

Many developers who write Windows Device driver are basically using Windows DDK for development. However, now many people have started to use some auxiliary tools. The author began to contact with Riverstudio last year, found that it is really a good development tool, not only write code when the idea is clear, and the combination of DDK is very good.

Of course, there are many people who feel that using DriverStudio is not authentic, or that the architecture of Windows Device driver is not well understood. I think it's a bit like the MFC-SDK relationship, and there's a lot of debate about it in many places, like the thousands of newsgroups, for nearly 2 months. Everyone has their own favorite, have their own habits, as long as you can do things well, I want to use what method should be the same. If you're used to developing with DDK, you can still use it, and if you think DriverStudio is good, what's wrong with trying to use a tool that can be programmed for you according to OOP concepts?

On the drive development web, you often see people asking questions about the use of DriverStudio. I was fortunate enough to use it for several drivers, including VxD, KMD and WDM, a little bit of experience, so want to write down to give you a little reference. If there is a mistake, you are welcome to point out to me, thank you.

Next I will introduce the process of developing a USB driver with DriverStudio. This USB device has 3 bidirectional endpoints, each of which is configured as follows:

EP type address buffer (Bytes)

0 In/out Control 0x80/0x00 16/16

1 in/out Bulk 0x81/0x01 16/16

2 in/out Bulk 0x82/0x02 64/64

The function that our driver needs to realize is to control the light and extinguish of the LED lights on the equipment, and to read and write the equipment through endpoint 2.

Since the Drivestudio is made up of several parts, we write this driver as long as we use driverworks, so we'll call it DW for short. Here, we assume that the reader has installed the DW correctly and that each library file has been compiled.

1. First, we start the VC IDE by using the shortcut "Setup DDK and start MSVC". The program that this shortcut points to will make some necessary settings and then start the VC IDE so that our program can use the header files and libraries of DDK and DW.

2. From the VC IDE menu "DriverStudio" select "Driverwizard", in the dialog box shown in Figure 1, write the project name. Here, we call this project: TEST, where the directory is D:\TEST. Then click the button "Next >".

Figure 1

3. In the next dialog box (Figure 2), we need to select the type of driver. Since the USB device driver is a WDM type, we select the second item and click the button "Next >".

Figure 2

4. In the 3rd dialog box (Figure 3), select the type of bus that our driver operates on. Here, we choose USB. Enter the vid and PID of the USB device in the USB vendor ID and USB Product ID. Suppose the vid and PID of our USB devices are 16 in 0471 and 1801 respectively. Then click the button "Next >". For the VID and PID regulations please refer to the USB-IF specification.

Figure 3

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.