메뉴 건너뛰기

공사박사

CONSTRUCTION
& with PLEASURE.

즐거운 공사를 위해 공사박사가 함께 합니다.

SATISFACATION
TOGETHER

공급자&수요자 모두가 만족합니다.

OVER 10 YEARS
MASTERS

10년 이상의 장인들과 함께 합니다.

ONE MORE
VISIT & MEET

한번 더 방문해서 만나고 싶은 인연을 만들어갑니다.

2017.10.24 09:14

Usblib Used

조회 수 7620 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
Extra Form
모집종류 keri.hawes@gmail.com
작업종류 33,1586,48332
First of all, this is to see the foreign forum after the study of the article, the independent translation as a note with, add part of the self-understanding, and all original.

Introduction:

libusb is an open source library that helps developers communicate with UBS devices at the user's level. If you want to know more, you can view their home page: http://libusb.org/

In its documentation, it is recommended that you first read the USB2 specification: http://www.usb.org/developers/docs/, which can help you really understand how USB works.

libusb installation:

You can get the source code from the official home page and compile and install it. Or the use of the release already contains a package that can be easily installed.

If the installation is complete, please continue

communication:

The communication between the device and the client is a clear idea called the use of the pipeline. Each pipe is a host on a software and an endpoint on the device. Each endpoint performs a specific target for the device, such as accepting commands or transferring data. A full-speed device can have up to 16 endpoints, and then the low-speed device has only three endpoints.

All USB devices support port 0 when powered. This port is the default target pipe. When the device connection is detected, the USBD software uses port 0 to initialize the device, perform a normal (non-special) configuration, and obtain information about other endpoints provided by the device. Endpoints are characterized by their number of endpoints (depending on the time of design), bus broadband, access frequency, latency, and processing error requirements.

Once the endpoint in the device is identified and configured, the pipeline will allow the client software to communicate with the device. Contact with a pipe is to describe the characteristics of the bus access and bandwidth, the type of transmission, the direction of transmission and the maximum data load size.

USB defines four transmission modes: control transmission, usually used to transfer commands and status operations; interrupt transmission, through the device to initialize some requests from the host; synchronous transmission, used to transmit the key events of the data (such as video and dialogue); Batch transmission, using all available bandwidth but not a specific time. All digital transmissions use the same format of packaging, including control information, data and error validation areas.

There are two types of pipes: the message pipe and the pipeline. Control the transmission using the message pipe. In the message pipeline, the data portion in each package is meaningful for the USB system software.

The pipeline is interrupted for transmission, synchronous transmission and batch transmission. In the stream pipeline, the data portion of each packet is meaningless for USB, and is only transmitted between the client software and the device.

Synchronous interface:

The synchronous interface allows you to call a USB transfer using a single function. When this function call returns, the transfer is already completed and the result is returned for parsing. The advantage of this approach is very clear: you can do anything with a simple function call.

Nevertheless, this interface still has its limitations. Your program will go into sleep when libusb_bulk_transfer () (when bulk transmission) until the transfer is complete. If it takes three hours, your program also needs to sleep the same time. The implementation will end in the library, the overall thread during this period is useless. Another problem is that when a single transfer thread ends, there is no need for multiple endpoints and multiple devices to perform I / O operations at the same time, unless you create a new thread. In addition, there is no chance that the transmission will be canceled when the request is submitted.

Equipment and interfaces:

In libusb, each USB device operates through the libusb_device and libusb_device_handle objects. The libusb API connects an open device to a specific interface. This means that if you request multiple interfaces on the device, you have to open the device several times to accept a libusb_dev_handle, which corresponds to the interface you want to communicate with each other. Do not forget to call libusb_dev_handle.

What does this mean? This means that you can complete the request interface before you can operate on the device. Similarly, you can release the interface before completing the device operation.

Each device has its own configuration, such as vendor id, product id and so on. We use these settings to find the required devices and work through these configurations. First we write a function to find out the configuration and print it out so that we can find the right one; our basic operations are as follows:

1. Initiate a library by calling libusb_init and create a conversation at the same time;

2. Call libusb_get_device_list to get the queues of the connected devices. This will create an array of libusb_device that contains all the usb devices connected to the system;

3. Loop through all the devices to check their options;

4. Find one of them, use libusb_open or libusb_open_device_with_vid_pid (when you know the device vendor id and product id) to open the device;

5. Use libusb_free_device_list to clear the queues obtained with libusb_get_device_list;

6. Request interface via libusb_claim_interface (requires you to know the interface value of the device);

7. Operate the desired I / O;

8. Release the device via libusb_release_interface;

9. Turn off your previously opened device with libusb_close;

10. Close the conversation pc sync via usb libusb_exit;

PS: English need hard training ah, a short tutorial article to see the stuttering

List of Articles
번호 제목 글쓴이 날짜 조회 수 추천 수
39 Is Very Cheap Four Jingdong Selling 32GB USB Recommended HermelindaFef0836 2017.12.02 2988 0
38 Who Can Not Fool Me! Teach You To Choose A Mobile Storage Device ShellieBonney9317966 2017.12.02 3041 0
37 How To Install The Win7 Original Pe Mirror System Tutorial JanellNeilsen73 2017.12.02 3000 0
36 IPhone16G Savior Sandisk IXpand U Disk Evaluation PreciousR5929976 2017.12.02 3198 0
35 Easy Wireless Transmission Flash Di 64G Mobile Phone USB Only 145 Yuan CatherineMmn90627 2017.12.02 3067 0
34 Tar Package Backup Directory When The Volume Package Compression (incremental Backup, And Automatically Split Into Multiple Files) GeorgiaBrookman 2017.10.27 25662 0
33 Hand To Teach You Fun SOCKET Model: Complete Port (Completion Port) Detailed AntoniettaCerda 2017.10.24 7592 0
32 Lenovo Mobile Phone A850 Open The USB Debugging Connection Not On The Computer How To Do Gaston68A1638982076 2017.10.24 7465 0
31 1 Control 4 Keyboard Synchronizer (no Drive) JeffreyPinnock54154 2017.10.24 7502 0
30 Xilinx, Arm, Cadence And TSMC Jointly Announced The World's First 7-nanometer Process CCIX Test Chip Ruby695625436640 2017.10.24 7599 0
» Usblib Used KeriHawes35792127416 2017.10.24 7620 0
28 FBackup Automatic Backup Software Download V5 4 799 Chinese Version LonnaTkn51221587 2017.10.09 9119 0
27 Computer Hard Disk Bad Inside All The Information Lost How To Do MaryjoTimperley009 2017.10.09 9366 0
26 Wang Haipeng JoyceFitzRoy55492834 2017.10.09 9252 0
25 Elasticsearch And Mongodb Distributed Cluster Environment Data Synchronization LatashiaLuker55 2017.10.09 9623 0
24 Copyright Printing JDTStephaine0060830 2017.10.09 9297 0
23 Nike Colts 12 Andrew Luck Royal Blue Team Color Mens Stitched NFL Limited Jersey Discount 20% Off TanishaPapst8475 2017.10.04 111 0
22 China Nfl Jerseys From Viamao CedricYarborough246 2017.09.30 53 0
21 68 Cyril Richardson Jersey W0J GlennaHaris3602814 2017.09.27 49 0
20 What Is The Function Of Glucosamine In A Dog Diet Regime KarineGresham77293 2017.09.26 56 0
Board Pagination Prev 1 2 Next
/ 2
GUIDE

START-UP with 공사박사

  • 사이트 제목 바꾸기

    대금 보호 서비스

    대금 보호 서비스를 이용하세요.
    혹시 수금이 안될까? 공사박사는 서울보증보험과 함께 대금 보호 서비스를 제공합니다.(자세히보기)

  • 메뉴 구조 구성하기

    장인들과의 만남

    10년 이상 장인들이 책임 시공합니다.
    공사 박사는 현장 경험 10년 이상인 장인분들 함께 만들어 가는 곳입니다.

  • 레이아웃 디자인 바꾸기

    평가 시스템 운영

    수요자 공급자 양방향 평가를 합니다.
    양방향 평가를 위해 수요자 공급자 모두의 가치를 끌어올립니다.

  • 초기화면 바꾸기

    무료 등록

    광고비가 없습니다.
    무료로 등록만 해 두시면 수요자와 공급자를 공사박사만의 특화된 시스템으로 매칭해 드립니다.

  • 기능과 디자인 추가하기

    일일 작업 리포트 제공

    진행 사항을 한눈에 확인 하실 수 있습니다.
    공사 박사가 제공하는 일일 작업 리포트로 공사 진행 사항부터 예상 완료 시점까지 체크할 수 있습니다.

  • 레이아웃 꾸미기

    자동 이력 관리

    자동 이력 관리 시스템으로 믿을 수가 있습니다. 공급자는 자신의 커리어를 관리할 수 있으며, 수요자는 공급자 선택에 신뢰가 생깁니다.

위로