主动通用usb驱动libusb引见和使用示例手艺文档安示例

gdwkb ,Jun 25 12:21 , 文章教程 , 评论(0) , 引用(0) , 阅读(106) , 本站原创 | |
主动  波特率  学问  细致  需求  过程  东西  装备
Tong∴Yong∴usbQu∴Dong∴libusbYin∴Jian∴He∴Shi∴Yong∴Shi∴Li∴Shou∴Yi∴Wen∴Dang∴An

小学问sudo insmod /lib/modules/2.6.22-14-generic/kernel/drivers/usb/ serial/usbserial.ko vendor=0x8086 product=0xd001同时插上ttyUSB0和ttyUSB1!obm能够将dkb下载上往!可是主动重起以后!就不克不及下载接上往的东西了!所以该当!需求close。然后停止接上往的下载!辨别调用两次不过该当主动封闭了!所以能够还是不克不及同时插上ttyUSB0和ttyUSB1lsusb 浮现usb装备的vendor和product比如b074gliethttp: lsusb Bus 002 Device 001: ID 0000:0000  Bus 001 Device 116: ID 8086:d001 Intel Corp. Bus 001 Device 003: ID 413c:2105 Dell Computer Corp. Bus 001 Device 002: ID 0461:4d15 Primax Electronics! Ltd Bus 001 Device 001: ID 0000:0000此中Bus 001 Device 116: ID 8086:d001 Intel Corp. 就是vendor=0x8086和product=0xd001能够使用dmesg来检查细致的是ttyUSB0还是ttyUSB1了pidof hello.exepidof bash浮现过程的pid值
波特率
define  B0    0000000        / hang up /
define  B50    0000001
define  B75    0000002
define  B110    0000003
define  B134    0000004
define  B150    0000005
define  B200    0000006
define  B300    0000007
Written by vikram_cvk - 2004-07-16 18:05
Introduction
We often come across a situation where a USB device which runs perfectly on Windows platform does not even get detected on Linux. Lack of support for USB devices is one of the reason why some people don"t embrace Linux. Now there is a new API by name Libusb which helps the developers to develop USB device drivers on the fly
What is Libusb
Libusb is a high-level language API which conceals low-level kernel interactions with the USB modules. It provides a set of function which are adequate to develop a device driver for a USB device from the Userspace.
Libusb is not complex
For any wannabe Linux Kernel programmers developing device driver as a Kernel module is a herculean task. Developing kernel modules requires fair degree of proficiency in "C" language and also good idea of kernel subsystems! data structures etc. All these are enough to put-off a developer from venturing into Device Driver programming.Libusb has been designed to address this shortcoming. Simplified interface allows developers to develop USB drivers from the userspace . Libusb library functions provide high level abstraction to the Kernel structures and allows the developers to have access to these structures through the USBFS.
Its Cross-platform
Beauty of Libusb lies in its cross platform functionality. Driver written for one platform could be easily ported onto another platform with little or no changes! currently following operating systems are supported by Libusb.
Linux
FreeBSD
Darwin
OS X
This HOWTO focuses on how Libusb can be used on Linux platform. For information about other platforms goto http://http://libusb.sourceforge.net/.
LIBUSB ON LINUX
Linux is the most popular platform for the Libusb API!the reason being growing popularity of Linux as a stable OS. On Linux Libusb makes of the USBFS file system. by default USBFS is automatically mounted when the system is booted.
What is USBFS
USBFS is a filesystem specifically designed for USB devices! by default this filesystem gets mounted when the system is booted and it can be found at /proc/bus/usb/. This filesystem consists of information about all the USB devices that are connected to the computer.Libusb makes use of this filesystem to interact with the USB devices.
Following C program can be a stepping stone into the world of Libusb.This program can be used to gather all the technical/hardware details of a USB device connected to the computer !ensure that some USB device is connected into the USB port.
Details like Vendor-Id ! Product-Id !Endpoint addresses of a USB device is of paramount importance for a device driver developer.
/ testlibusb.c /
include
include
void print_endpoint

printf。
printf。
printf。
printf。
printf。
printf。

void print_altsetting

int i。
printf。
printf。
printf。
printf。
printf。
printf。
printf。 小学问sudo insmod /lib/modules/2.6.22-14-generic/kernel/drivers/usb/ serial/usbserial.ko vendor=0x8
飞扬黑客网  http://www.gdwkb.cn
发表评论

昵称

网址

电邮

打开HTML 打开UBB 打开表情 隐藏 记住我 [登入] [注册]