Presentation is loading. Please wait.

Presentation is loading. Please wait.

LibUSB - Create a Solution Without the Class Struggle

Similar presentations


Presentation on theme: "LibUSB - Create a Solution Without the Class Struggle"— Presentation transcript:

1 LibUSB - Create a Solution Without the Class Struggle
Welcome to this USB session! We will be talking about some basics of USB, and LibUSB in particular. LibUSB is a great place to start with USB as we are not dealing with a class, so there are no class related issues blocking our view of just “plain basic USB”. . All you need is the target board, which I believe you will be given at Devcon, Some things will be familiar to you, and some perhaps not, but I thnk most will learn something; USB basic concepts, or that some USB PC host mechanisms becomes clearer. The lab that follows is not hard. It mainly consists of reading and digesting the info. The important thing is that you understand what is happening. Do it at your pace. You can finish the lab at home some USB-cables and a few PC software installs.

2 Connect to the Smart Society with USB!
Smart Society Challenge You need to: Get your idea to market SOON Avoid the complexity of a class Quickly test a complete PC-host / target concept You need to be “Vendor Specific” but don’t want to write a new Windows driver You don’t want to learn all about HID descriptors Solution Use LibUSB! Today you will get a complete USB Host-PC to RX-function ‘template’ solution RX = Connect to the Smart Society with USB! Challenge: You want to get your smart solution to market ASAP, but you don’t want to learn x-hundred pages of the class—X spec. Then, unless you need to follow a class, use LibUSB! Solution: Today we will give you a complete Host-PC to RX-target ‘template’ USB solution to take home!

3 Agenda I: USB Basics II: LibUSB III: Lab IV: Conclusion Host Function
Class II: LibUSB Why use LibUSB? What is LibUSB? Win32-LibUSB Enumeration, INF-file Customer Install III: Lab RX Target YRDK63N – PC Host Python app To do lab at home, download “LibUSB - A Complete RX Function and PC Host Solution”, R01AN0492_RX600_LibUSBv2 IV: Conclusion How to communicate with any USB device with LibUSB Here is the agenda for this session. The presentation is divided into two parts. First a part on some USB basics, which is a repetition of what most of you at least partially understand. But this will give you the chance to ask a question about something obvious that you woendered but never bothered to ask. Unless there are questions here, I will go through part 1 rapidly. Part II is about LibUSB, then we will do the lab. The lab is mostly reading and understanding, and if you don’t finish, you can easily finish the lab at home by downloading the LibUSB package from the Renesas Software donwload and run it on your YRDK63N. At the end, we will show how to connect and communicate with any USB device with LibUSB. Class Solutions

4 Ready-made USB Class Solutions
Do follow a class when Your solution naturally belongs there Driver already exists in Windows Industry practise mandates certain class Renesas has available source code for classes Mass Storage HMSC PMSC Communications Device HCDC PCDC Human Interface HHID PHID P.S. Think you “need” OTG??... ? Certain professional domains mandate a certain class, and sometimes it is more convenient for a user to not have to do any installs for common device classes, where drivers are already installed on a system (a mouse, a keyboard). In such case, Renesas has support for many classes. Here is a list of classes already available as source code. Since we have these classes, you obviously should not use LibUSB when these are the ‘standard’ for the environment you are dealing with. For situations where an application is unique, simple, etc, there is no reason to follow a complicated class specification. In this case one is free to use a so called "Vendor" class, and for that, use "LibUSB". This can make development significantly faster. P.S. If someone tells you “we need OTG” make sure to view this presentation! Send me an and I will send it to you! Why LibUSB?

5 Why LibUSB? No class exists for what you want to do - examples:
HID HID class only has control and interrupt endpoints – you need bulk / isochronous You don’t want to learn all about report descriptors Don’t want to ‘waste’ code and time parsing them… CDC CDC limited to one bulk in and one bulk out EP – you need more The USBSER.SYS Windows driver causes you grief To avoid the complexity of a class You need to minimize code space LibUSB is free from class protocol overhead Host Windows driver does not cooperate / has bug You’ve decided to be “Vendor Specific” - but don’t want to write a new Windows driver To quickly try out a complete PC-host / target concept Consider LibUSB! First of all.. WHY use LibUSB? There are several answers to this. Perhaps there is no class exists for what you want to do. For example, you want to use the HID class to send data to host, but HID only has interrupt endpoints and you need bulk and/or isochronous endpoint, or you don’t want to learn all about report descriptors or don’t want to ‘waste’ prescious code and time parsing them as the spec mandates… Let’s say you considered the CDC class, but don’t need the full complexity of it, or the windows cdc driver has problems (which we know it does). The CDC class is limited to one endpoint perhaps you need more. You want to avoid the complexity of a 100 page class specification. - Perhaps you need to minimize code space. LibUSB is free from class protocol overhead - Perhaps the host Windows driver does not cooperate or has a bug, and you don’t want to write new Windows driver You need to be “Vendor Specific”, but again, you don’t want to write a new Windows driver You want to quickly try out a complete PC-host / target concept In such case, consider using LibUSB! This icon will symbolize LibUSB.

6 USB – the most ubiquitous serial bus ever
USB Basic Concepts But, let’s not get ahead of ourselves. In case some of you are not familiar with some USB Basics, here is a crash course.. Transfer Types

7 Transfer Types - Basics
Determines how 1 ms (FS) frames are filled with user data Transfer Type is set for each endpoint in “Pipe Information Table” (PIT) Control Used for EP0, control commands at e.g. enumeration: “Standard Device Requests” = get_descriptor, set_interface,.. (Can be used by Vendor Specific application for user data) Interrupt Max latency guaranteed; ms Example: keyboard, mouse Isochronous Bandwidth guaranteed (latency is not) Fixed nr of bytes per frame Example: Audio Bulk For time insensitive data 1 ms frame is filled with bulk data after other types have taken what they need Example: mass storage There are different ways the data is packaged and timed within 1 ms frames on the Full speed USB bus. The types are referred to as Transfier Types. Which type is used for an endpoint is set in the Pipe Information Table. The control transfer type is for enumeration. The control ednpoint can also be used by user for simple data exchange (Vendor class). Interrupt transfer is used for data that needs to have a maximum latency. It may be of interest for you to understand though, that even for an interrupt endpoint the host is always the one to trigger communication at the lowest level. Isochronous transfer is for data that must come in regular timed intervals. And finally, for general time-insensitive data exchange, the Bulk type endpoint is used to send data within the USB frames whereever there is room. Host

8 ? Host - Basics Controls enumeration At lowest level
Reads descriptors from a USB function to learn about VID/PID, endpoints… At lowest level Host initiates transactions - even for interrupt endpoints! Continually polls a device just to see if it has data to transfer Keeps USB protocol “simple”  (but not very energy efficient) Poll rate specified by the function’s EP descriptor At application level Host or function can request to send data! Some key points about a USB host that I think its good to be aware of; one slide: A USB host Controls enumeration, reads descriptors from function, and thereby learns about the VID and PID, the endpoints it can use to communicate with the target etc. To clear up some possible confusion, note that at the lowest level, a USB function is incapable of transferring data or generating an interrupt without being polled by the host, it can only indicate the rate at which it wants to be polled in the event that activity occurs. This is specified in the endpoint descriptor and P.I.T which we shall look at later. This does make the USB hardware somewhat energy inefficient. But at the application level, a host or function can request to send data. ? Function

9 Function - Basics USB “Function” “Device” or “Peripheral” ~ the same thing! Function = “A USB device that provides a capability to the host, such as an ISDN connection, a digital microphone, or speakers.” Device = “A logical or physical entity that performs a function” =>A device may contain several functions Peripheral = Not in spec. Could mean the USB hardware of host or function node. “Peripheral” or “device” could refer to host USB HW – confusing!? ? Often the terms USB “Function”, “Device”, and “Peripheral” are used interchangeably. Just be aware that they normally just refer to what is defined as a “USB Function” which is “a USB device that provides a capability to the host,..” This could be e.g. a printer, a digital microphone, or speakers. The word Device is very similar – What is the difference? (Wait for answer: - A Device could contain multiple functions). The word peripheral COULD mean the USB hardware in the MCU that handles the lowest levels of the USB protocol, up to the transaction layer. So, I use the term USB Function to avoid confusion. Function

10 ? ? Function - Basics Endpoint
Used by application level (host and function) to send data EP number determines meaning of transmitted data (Speed, LED data, display color,..) Defined by function Host learns about the endpoints via descriptors As you will see in lab Example; “EP1 OUT” “IN” or “OUT” = Dataflow as seen from host ? ? In order for meaningful information to be shared by host and peripheral at the application level, something called endpoints are used. At both the host and function application level the EP number used to determine the meaning of transmitted the data. Endpoints are defined by the function. As we mentioned, the host learns about the endpoints via descriptors during enumeration, as we will see in the lab. For example, an endpoint could be named “Endpoint 1 OUT“. IN or OUT signifies the dataflow direction as seen from host. Descriptors

11 Descriptors - Basics Defined by USB function
At enumeration, host uses get_descriptor(X) to learn about function Device descriptor Contains VID & PID PC selects INF-file with matching VID+PID [DeviceList] %USB\VID_8765&PID_1234.DeviceDesc%=USBBulkInstall, USB\VID_8765&PID_1234 VID from USB Implementers forum PIDs managed indendently by the VID owner A USB function has “descriptors”. These describe the function and are retrieved by the host during enumeration with the Standard Device Request “Get-Descriptor” with an argument that determines which descriptor is sought. There are different types of descriptors. - The Device descriptor is the first one the host fetches. It contains the VID & PID numbers. The host looks in its stash of “DeviceList” entries which originally come from the INF file that was supplied at installation of the device. With the INF-file information, the host now knows what class the device belongs to and therefore what driver to use, and how to interpret incoming data The Vendor ID is supplied by the USB Implementers forum for a fee. --- [If question arises “How do I get a Vendor ID?” the answer is that VIDs are owned by the vendor company and are assigned by USB-IF. for more information on USB-IF membership and obtaining a VID. Product IDs (PIDs) are assigned by each vendor as they see fit.] String descriptors are used for example to, as is shown above right, display the device in the Windows Device Manager. The Configuration descriptor contains interface descriptors, which we wont talk about now, but also endpoint descriptors. Here is an example. Where is it defined? (The function.) We see it has seven fields and there are the EP#, direction and transfer type, so this must match what is in the PIT. Enumeration

12 Enumeration - Basics Plug in the device – Host fetches Device descriptor containing VID and PID How is driver found? INF file Windows uses DeviceID = VID+PID string to pick driver Located in C:\Windows\system\INF Windows search when new device plugged in If matching INF-file not found? “Found New Hardware” pops up ? ? Let’s say you plug in a new device. The first thing the Host does is fetch the Device descriptor, which contains the VID and PID. Windows then searches its registry based on previously read INF-files for a matching Device ID, which is a string contiaining the VID and PID to know what device driver to use. If a matching DeviceID is not found, the “Found New Hardware” pops up. This means that you need to create an INF file for your. To create an INF-file for your solution, you can use the INF-Wizard included in the Libusb-win32 package. It is a GUI and will ask you for information that it cannot figure out by communicating with the device. Enumeration

13 Example enumeration: VID=45B, PID=0512 detected… Enumeration - Basics
Windows found matching DeviceID in this file. => This is the correct INF-file! What drivers Windows will use At enumeration, VID 45B and PID 492 are detected at enumeration in the device descriptor. If Windows finds a matching “DeviceID in any file in its system/INF directory, it knows that is the correct INF file, and gets class, what driver to use etc information from this file. Some of this info is shown in Windows Device Manager, example info shown in red here.

14 Windows can now use info in INF- file info for multiple purposes
Enumeration - Basics Windows can now use info in INF- file info for multiple purposes Displayed in Device Mgr. At enumeration, VID 45B and PID 492 are detected at enumeration in the device descriptor. If Windows finds a matching “DeviceID in any file in its system/INF directory, it knows that is the correct INF file, and gets class, what driver to use etc information from this file. Some of this info is shown in Windows Device Manager, example info shown in red here. Descriptors

15 Descriptors - Basics Device descriptor to select host driver
String descriptors Describes function with text to host There can be multiple.. ..Many different uses Configuration descriptor Contains Interface descriptor(s) Endpoint descriptors Let’s move on to the other descriptors. We just saw the Device descriptor in action as the first one the host fetches. String descriptors are used to describe verbally the device to the host. There are often a number of string descriptors. At enumeration, the function tells the host how many it has. String descriptors can have many different uses. The Configuration descriptor contains interface descriptors, which we wont talk about now, but also endpoint descriptors. Here is an example. Where is it defined? (The function.) We see it has seven fields; there are the EP#, direction, transfer type, and max polling interval. This must match what is in the PIT. Pipe

16 ? Pipe - Basics Node’s “channel” of communication for certain endpoint
Pipe  endpoint pairing in PIT Function PIT defined statically at compile time Host PIT setup at enumeration A pipe is a physical entity in the USB HW of the node. It is a node’s “channel” of communication and is associated with one endpoint.* Which pipe is used for an endpoint is determined locally by each node. In other words the host and function use there own individual pipes. In the RX firmware there is something called Pipe Information Table. The table is defined statically in c-code by the function. The host sets up the table “dynamically” during enumeration. PIT includes - pipe number, endpoint number - Direction of data flow (IN, OUT) - Transfer type (Control, Bulk,..) Max buffer size (nr bytes physical pipe will transfer each transaction) The rate of host polling can be different for each device. The requested maximum number of milliseconds between transaction attempts (the bInterval variable is ignored for bulk and control endpoints). [Extra, if question] For the RX, there are some restrictions: Pipe 0 is to be used only for control transfers, Pipe 1 and 2 for bulk or isochronous transfers, Pipe 3 to 5 for bulk transfers only, and Pipe 6 to 9 are to be used only for interrupt transfers. *A USB pipe is an association between an endpoint on a device and software on the host. Pipes represent the ability to move data between software on the host via a memory buffer and an endpoint on a device. [USB 2.0 spec.] – But note that also a funtion needs a pipe to communicate back to the host. ?

17 Pipe - Basics PIT element members Pipe  Endpoint number
Direction of data (IN, OUT) Transfer type etc… A pipe is a physical entity in the USB HW of the node. It is a node’s “channel” of communication and is associated with one endpoint.* Which pipe is used for an endpoint is determined locally by each node. In other words the host and function use there own individual pipes. In the RX firmware there is something called Pipe Information Table. The table is defined statically in c-code by the function. The host sets up the table “dynamically” during enumeration. PIT includes - Endpoint number - Direction of data flow (IN, OUT) - Transfer type (Control, Bulk,..) - Max buffer size (nr bytes physical pipe will transfer each transaction) [Extra if question] For the RX, there are some restrictions: Pipe 0 is to be used only for control transfers, Pipe 1 and 2 for bulk or isochronous transfers, Pipe 3 to 5 for bulk transfers only, and Pipe 6 to 9 are to be used only for interrupt transfers. *A USB pipe is an association between an endpoint on a device and software on the host. Pipes represent the ability to move data between software on the host via a memory buffer and an endpoint on a device. [USB 2.0 spec.] – But note that also a funtion needs a pipe to communicate back to the host. Class=?

18 What is a USB Class? - Basics
Group of similar functionality / services Predefined descriptor set Same host driver (No ‘Found New HW’) USB classes defined by USB-IF A class is a group of USB functions with similar services. A class uses predefined set of Configuration, Interface, String & Endpoint Descriptors. The host driver for any connected function of class is one and the same. No new driver is needed. USB classes are defined by the USB-IF. USB functions with very similar services can be goruped into somehting called a class, with a detailed specification. The class predefines the descriptors’ formats. This way, there is a common host driver for any connected device belonging to a class. Class=?

19 The class specifications are all available from the USB-IF site.
There are some 20-something standard classes. Class documents

20 Vendor Specific - Basics
Class does allow some descriptor data to be unique vendor string capabilities data format …without being “Vendor Specific” If any descriptor item named ‘xxxClass’ or ‘xxxProtocol’ is set to 0xFF; Not a class!  “Vendor Specific” New INF-file needed! New host driver needed The class allows for some descriptors to be unique. These are things like Vendor string, capabilities, data format, etc. This does not mean the device is “Vendor Specific”. But, if ANY descriptor item is set to oxFF, the term Vendor Specific applies. This term is used in the specs to say that the device deviates from the class in some way. the descriptor. If this is the case, a unique INF-file and probably a new host driver (depending on the capabilities of the existing host driver). This is the chief advantage of using a pre-defined class – no need to create host driver! LibUSB

21 LibUSB That concludes the USB Basics part. Lets move on to learn what LibUSB is!

22 An API for host (PC) applications
What is LibUSB? An API for host (PC) applications Includes PC driver to enable PC-application USB function communication Open source Windows XP, Vista, Win7: Libusb-win32 Contains driver LibUSB.dll A pre-written, pre-tested, generic driver Linux Even easier for user than for Windows: If no other class is associated, USB kernel (usbfs) automatically associates LibUSB with device LibUSB is a PC API and driver that makes PC-application to USB function communication possible. It is open source, and there is a port for Windows called “Libusb-win32”. Linux also has a port, and many say that Linux us especially easier to set up than for Windows as there is a generic USB kernel driver that can be compiled into the kernel called usbfs. An advantage of the usbfs module is that when no driver is active for a USB device, the usbfs driver will be automatically attached to the device so that you can use LibUSB, that is, the user does not go through the Found New HW wizard to associate the device with the LibUSB driver. Libusb-win32

23 Libusb-win32 - But I don’t want my customer installing things!
Installer adds libusb0.sys, libusb0_x86.dll to C:\windows\system\drivers The ability to communicate with USB devices referred to as the “Windows LibUSB Backend” Comes with “INF-file Wizard” Test tool “Install-filter” Access ANY device via LibUSB - But I don’t want my customer installing things! Customer needs only INF-file and DLLs Will be installed via Windows HW Popup Wizard The most commonly used LibUSB port to Windows is Libusb-win32. The package includes an installer which puts the drivers libusb0.sys and libusb0_x86.dll into C:\windows\system\drivers. Libusb-win32 includes a GUI called “INF-file Wizard” that greatly simplifies creating an INF-file for our project. Also included is a test tool “Install-filter” which enables access to ANY device via LibUSB. More on that at the end. This whole mechanism that libusb-win32 sets up is sometimes referred to as the Windows LibUSB Backend. INF-Wizard

24 ? INF-Wizard How create custom INF-file? INF-Wizard
Easy to create INF-file! INF-Wizard starts up by listing all connected devices via LibUSB Any info it cannot get from incoming descriptors it will ask you for Comes with Libusb-Win32 As we toucheon when it comes to enumeration, Windows then searches its registry based on previously read INF-files for a matching Device ID to know what device driver to use. If a matching Device ID is not found, the “Found New Hardware” pops up. For your solution, this means that you need to create an INF file for your solution. To create an INF-file for your solution, you can use the INF-Wizard included in the Libusb-win32 package. It is a GUI and will ask you for information that it cannot figure out by communicating with the device.

25 INF-Wizard Result You entered Vendor name into INF-Wizard… You selected VID, PID in first Wizard window. (Wizard got it using LibUSB’s get_descriptor(DEVICE) The information in the INF-file comes from different places. The INF-Wizard figured it all out for you! For example, the Wizard starts by getting the by fetching the Device Descriptor. The Device Descriptor contains “DeviceID” which is a string containing VID and PID, and it also contains the Class. In our case, the class is LibUSB. The rest of the information is a combination of data you entered, from the descriptors, and what INF Wizard knows is needed. The information in the INF-file comes from different places. The INF-Wizard figured it all out for you!

26 PC Application Level Tools for LibUSB
That concludes the USB Basics part. Lets move on to learn what LibUSB is!

27 Tools to create PC applications that use LibUSB
There are plenty of application level open source projects that use LibUSB. Here is a list. We will use PyUSB, built using the Python language.

28 Lab uses Python & PyUSB Python PyUSB Create PC applications
Object-oriented language Object.property = 5 #Set a variable Object.procedure() #Run a procedure Easy to get started (compared to C++)? No cost/license GUI modules for Python: Tkinter, wxPython PyUSB Python module from sourceforge.net/apps/trac/pyusb PyUSB accesses the Windows LibUSB driver (LibUSB.dll) Uses libusb-1.0 (invoked by libusb10.py) The lab uses Python for the PC USB host application. Python is object-oriented., so this is the syntax to assign variables and run procedures, you can see the familiarity with other OO languages. Pthon is easier to get started with compared to a C++ based language in this presenter’s opinion. It is free and is downloaded and installed from the Python.org website. You can add a GUI for the user interface using either Tkinter or wxPython. Tkinter is more mature and comes with Python, wxPython is newer with perhaps a more glossy look, but is not as well documented. The lab application uses PyUSBThere is a module called PyUSB that is needed for LibUSB, and is downloaded separately. This module contains a LibUSB API that can interface with the PC LibUSB backend. Both libusb0.1 and 1.0 are used by pyusb, with the modules libusb01.py and libusb10.py. No need to download.

29 LibUSB Calls Find USB device(s) Standard Device Requests
find_devices()  Standard Device Requests get_descriptor(x) - Retrieve device descriptor x set_configuration(x) - Set configuration x of device R/W to endpoints write_endpoint(), read_endpoint() YOU WILL USE ALL THESE IN LAB Lab output Import PyUSB Here is some of the application level functionality available with LibUSB. - Find connected devices Standard Device requests as per the USB specification such as Get Descriptor Set a configuration As well as the ability to read and write to endpoints. You will use all these functions here, and more, in the lab.

30 Customer Install That concludes the USB Basics part. Lets move on to learn what LibUSB is!

31 Customer Install Your product install will need to provide the following (Or have the user download): INF-file with your DeviceID (VID&PID string) LibUSB drivers (libusb0.sys & libusb_x86.dll) A PC user application Python, PyUSB? In the Renesas LibUSB download, Python & PyUSB not needed. PyInstaller was used to convert the application to an EXE-file. ? In a finished product install customer must download or receive on some media.. .. an INF-file with your VID&PID .. the associated LibUSB drivers (libusb0.sys & libusb_x86.dll) .. and of course the PC user application. Plus anything else the application may need – for example in our case Python and PyUSB. However, in the Renesas LibUSB package example from Renesas Software Download site, Python and PyUSB are not needed for end user as PyInstaller was used to convert the app to an EXE-file and a bunch of DLLs. Lab

32 Lab Host: “Renesas_libusb_host_lab.py”
Function: LibUSB project R01AN for RSK62N, or YRDK63N The demo Set an LED (host->RX) Write to LCD (host->RX) Take an ADC measurement (host->RX) + send it over USB to host (RX->host) In the lab you run a host Python application using PyUSB for talking with the board. PyUSB talks with the PC’s LibUSB driver. As function we use the slightly modified project R01AN0492 for RSK62N (added interrupt EP). The Target board application can set an LED, Write to LCD, take an ADC measurement and send the ADC measurement over USB…

33 Lab Endpoints Control (enumeration) Bulk (general data transfer)
EP0 OUT Bulk (general data transfer) Lab commands to RSK; EP1 OUT Set an LED Write to the LCD Take an ADC measurement Read ADC data from RSK; EP2 IN Interrupt (e.g. user input) Read demo data when SW1 is pushed; EP3 IN …using these endpoints.

34 Access ANY USB Device! Updates
You can talk to ANY USB device with LibUSB! Learn about connected devices, test, … Run “LibUSB Install-filter” - comes with Libusb-win32 You enable a device from a list Now you can read descriptors, read/write endpoints without an associated INF-file But, do not change interface or configuration if device already enumerated by Windows (Linux) PC’s USB subsystem may crash!!! LibUSB updates libusbx Has newer LibUSB library and Windows driver Fully backwards compatible Main site: Reasons for: Finally, I wanted to mention that you can talk to ANY USB device with LibUSB! There is a tool called LibUSB-Win32 Install-filter which can easily be used to do this. Using this, you can quickly have access to the device and read descriptors, read & write endpoints etc. But, do not change interface or configuration as the device is already enumerated. The whole USB system of the PC may hang!!! There is also an alternative tool that can be used instead of the “LibUSB Install-filter” called Zadig. This has not been tested by the author at the time of this writing.

35 Libusb-Win32 FAQ

36 Summary Use LibUSB when
No class exists for what you want to do Examples HID HID class only has control and interrupt endpoints – you need bulk / isochronous You don’t want to learn all about report descriptors Don’t want to ‘waste’ code and time parsing them… CDC CDC limited to one bulk in and one bulk out EP – you need more The USBSER.SYS Windows driver causes you grief You need to minimize code space LibUSB is free from class protocol overhead The host Windows driver does not cooperate / has bug You don’t want to write a new Windows driver You want to avoid the complexity of a class You need to be “Vendor Specific” And again, you don’t want to write a new Windows driver You need to quickly try out a complete PC-host / target concept First of all.. WHY use LibUSB? There are several answers to this. Perhaps there is no class exists for what you want to do. For example, you want to use the HID class to send data to host, but HID only has interrupt endpoints and you need bulk and/or isochronous endpoint, or you don’t want to learn all about report descriptors or don’t want to ‘waste’ prescious code and time parsing them as the spec mandates… Let’s say you considered the CDC class, but don’t need the full complexity of it, or the windows cdc driver has problems (which we know it does). The CDC class is limited to one endpoint perhaps you need more. - Perhaps you need to minimize code space. LibUSB is free from class protocol overhead - Perhaps the host Windows driver does not cooperate or has a bug, and you don’t want to write new Windows driver You want to avoid the complexity of a 200 page class specification. You need to be “Vendor Specific”, but again, you don’t want to write a new Windows driver You want to quickly try out a complete PC-host / target concept In such case, consider using LibUSB! This icon will symbolize LibUSB.

37 Connect to the Smart Society with USB!
Smart Society Challenge You need to get your idea to market SOON avoid the complexity of a class quickly try out a complete PC-host / target solution You need to be “Vendor Specific” but don’t want to write a Windows driver You don’t want to learn all about HID descriptors etc.. Solution Use LibUSB! Do you agree? RX = Connect to the Smart Society with USB! Challenge: You want to get your smart solution to market ASAP, but you don’t want to learn x-hundred pages of the class—X spec. Then, unless you need to follow a class, use LibUSB! Solution: Today we will give you a complete Host-PC to RX-target ‘template’ USB solution to take home!

38


Download ppt "LibUSB - Create a Solution Without the Class Struggle"

Similar presentations


Ads by Google