Suche senden
Hochladen
Linux usb2ether
•
3 gefällt mir
•
3,073 views
Tom Sun
Folgen
Technologie
Melden
Teilen
Melden
Teilen
1 von 29
Jetzt herunterladen
Downloaden Sie, um offline zu lesen
Empfohlen
Datavideo HS-1000
Datavideo HS-1000
AV ProfShop
Nvidia Cuda Apps Jun27 11
Nvidia Cuda Apps Jun27 11
Dominic Monkhouse
XS Boston 2008 SR-IOV
XS Boston 2008 SR-IOV
The Linux Foundation
Intel_Low Power Intelligent Solutions with Intel Atom Processor
Intel_Low Power Intelligent Solutions with Intel Atom Processor
Işınsu Akçetin
Ludden q3 2008_boston
Ludden q3 2008_boston
Obsidian Software
Sony MCS-8M
Sony MCS-8M
AV ProfShop
Xensummit2009 Io Virtualization Performance
Xensummit2009 Io Virtualization Performance
The Linux Foundation
HP - HPC-29mai2012
HP - HPC-29mai2012
Agora Group
Empfohlen
Datavideo HS-1000
Datavideo HS-1000
AV ProfShop
Nvidia Cuda Apps Jun27 11
Nvidia Cuda Apps Jun27 11
Dominic Monkhouse
XS Boston 2008 SR-IOV
XS Boston 2008 SR-IOV
The Linux Foundation
Intel_Low Power Intelligent Solutions with Intel Atom Processor
Intel_Low Power Intelligent Solutions with Intel Atom Processor
Işınsu Akçetin
Ludden q3 2008_boston
Ludden q3 2008_boston
Obsidian Software
Sony MCS-8M
Sony MCS-8M
AV ProfShop
Xensummit2009 Io Virtualization Performance
Xensummit2009 Io Virtualization Performance
The Linux Foundation
HP - HPC-29mai2012
HP - HPC-29mai2012
Agora Group
Overview of cryptography and enhancements on z/VSE 4.3
Overview of cryptography and enhancements on z/VSE 4.3
IBM India Smarter Computing
Sony Anycast AWS-G500E
Sony Anycast AWS-G500E
AV ProfShop
Datavideo MS-1000
Datavideo MS-1000
AV ProfShop
JVC SR-HD1500
JVC SR-HD1500
AV ProfShop
Power Mac G5 ( Late 2005) Technical Specifications
Power Mac G5 ( Late 2005) Technical Specifications
Social Media Marketing
Sun fire x2250 technical training presentation
Sun fire x2250 technical training presentation
xKinAnx
Craneboard
Craneboard
Mistral Solutions
Ether sam testing methodology
Ether sam testing methodology
Hameza Abdul Hamid
Cots moves to multicore: AMD
Cots moves to multicore: AMD
Konrad Witte
Cisco UCS - Servidores
Cisco UCS - Servidores
Bruno Banha
Shuttle Highlights 2011 (EN)
Shuttle Highlights 2011 (EN)
Shuttle Computer Handels GmbH
IBM zEnterprise FAQs
IBM zEnterprise FAQs
IBM India Smarter Computing
Cis82 e2-1-packet forwarding
Cis82 e2-1-packet forwarding
Harjanto Handi Kusumo
AMD Analyst Day 2009: Rick Bergman
AMD Analyst Day 2009: Rick Bergman
AMD
Hardware assisted Virtualization in Embedded
Hardware assisted Virtualization in Embedded
The Linux Foundation
AMD Opteron 6200 and 4200 Series Presentation
AMD Opteron 6200 and 4200 Series Presentation
AMD
XS Oracle 2009 PV USB
XS Oracle 2009 PV USB
The Linux Foundation
Usb In-a-Nutshell
Usb In-a-Nutshell
Avalue Technology
USB Drivers
USB Drivers
Anil Kumar Pugalia
Project ACRN USB mediator introduction
Project ACRN USB mediator introduction
Project ACRN
Design Of A Usb Device Driver (Overview)
Design Of A Usb Device Driver (Overview)
allankliu
Usb In A Nutshell
Usb In A Nutshell
allankliu
Weitere ähnliche Inhalte
Was ist angesagt?
Overview of cryptography and enhancements on z/VSE 4.3
Overview of cryptography and enhancements on z/VSE 4.3
IBM India Smarter Computing
Sony Anycast AWS-G500E
Sony Anycast AWS-G500E
AV ProfShop
Datavideo MS-1000
Datavideo MS-1000
AV ProfShop
JVC SR-HD1500
JVC SR-HD1500
AV ProfShop
Power Mac G5 ( Late 2005) Technical Specifications
Power Mac G5 ( Late 2005) Technical Specifications
Social Media Marketing
Sun fire x2250 technical training presentation
Sun fire x2250 technical training presentation
xKinAnx
Craneboard
Craneboard
Mistral Solutions
Ether sam testing methodology
Ether sam testing methodology
Hameza Abdul Hamid
Cots moves to multicore: AMD
Cots moves to multicore: AMD
Konrad Witte
Cisco UCS - Servidores
Cisco UCS - Servidores
Bruno Banha
Shuttle Highlights 2011 (EN)
Shuttle Highlights 2011 (EN)
Shuttle Computer Handels GmbH
IBM zEnterprise FAQs
IBM zEnterprise FAQs
IBM India Smarter Computing
Cis82 e2-1-packet forwarding
Cis82 e2-1-packet forwarding
Harjanto Handi Kusumo
AMD Analyst Day 2009: Rick Bergman
AMD Analyst Day 2009: Rick Bergman
AMD
Hardware assisted Virtualization in Embedded
Hardware assisted Virtualization in Embedded
The Linux Foundation
AMD Opteron 6200 and 4200 Series Presentation
AMD Opteron 6200 and 4200 Series Presentation
AMD
Was ist angesagt?
(16)
Overview of cryptography and enhancements on z/VSE 4.3
Overview of cryptography and enhancements on z/VSE 4.3
Sony Anycast AWS-G500E
Sony Anycast AWS-G500E
Datavideo MS-1000
Datavideo MS-1000
JVC SR-HD1500
JVC SR-HD1500
Power Mac G5 ( Late 2005) Technical Specifications
Power Mac G5 ( Late 2005) Technical Specifications
Sun fire x2250 technical training presentation
Sun fire x2250 technical training presentation
Craneboard
Craneboard
Ether sam testing methodology
Ether sam testing methodology
Cots moves to multicore: AMD
Cots moves to multicore: AMD
Cisco UCS - Servidores
Cisco UCS - Servidores
Shuttle Highlights 2011 (EN)
Shuttle Highlights 2011 (EN)
IBM zEnterprise FAQs
IBM zEnterprise FAQs
Cis82 e2-1-packet forwarding
Cis82 e2-1-packet forwarding
AMD Analyst Day 2009: Rick Bergman
AMD Analyst Day 2009: Rick Bergman
Hardware assisted Virtualization in Embedded
Hardware assisted Virtualization in Embedded
AMD Opteron 6200 and 4200 Series Presentation
AMD Opteron 6200 and 4200 Series Presentation
Ähnlich wie Linux usb2ether
XS Oracle 2009 PV USB
XS Oracle 2009 PV USB
The Linux Foundation
Usb In-a-Nutshell
Usb In-a-Nutshell
Avalue Technology
USB Drivers
USB Drivers
Anil Kumar Pugalia
Project ACRN USB mediator introduction
Project ACRN USB mediator introduction
Project ACRN
Design Of A Usb Device Driver (Overview)
Design Of A Usb Device Driver (Overview)
allankliu
Usb In A Nutshell
Usb In A Nutshell
allankliu
Introduction to SCSI over FCP for Linux on System z
Introduction to SCSI over FCP for Linux on System z
IBM India Smarter Computing
An1003 usb
An1003 usb
Eng Seng Lim
USB 3.0 CAPTURE HDMI 4K with Loop-through for Image redistribution
USB 3.0 CAPTURE HDMI 4K with Loop-through for Image redistribution
Naoto MATSUMOTO
Алексей Мисник - USB устройства для пентеста
Алексей Мисник - USB устройства для пентеста
HackIT Ukraine
Usb in-a-nutshell
Usb in-a-nutshell
boybk88
Chapter_2_CCNA2
Chapter_2_CCNA2
sunabozu
Networking with Linux on System z
Networking with Linux on System z
IBM India Smarter Computing
High Definition Fuzzing; Exploring HDMI vulnerabilities
High Definition Fuzzing; Exploring HDMI vulnerabilities
E Hacking
Paper id 252014121
Paper id 252014121
IJRAT
Advance of usb
Advance of usb
PREMAL GAJJAR
Xctu
Xctu
Ferry Wahyu Wibowo
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
KaoMao
Embedded I/O Management
Embedded I/O Management
Anil Kumar Pugalia
“Automation Testing for Embedded Systems”
“Automation Testing for Embedded Systems”
GlobalLogic Ukraine
Ähnlich wie Linux usb2ether
(20)
XS Oracle 2009 PV USB
XS Oracle 2009 PV USB
Usb In-a-Nutshell
Usb In-a-Nutshell
USB Drivers
USB Drivers
Project ACRN USB mediator introduction
Project ACRN USB mediator introduction
Design Of A Usb Device Driver (Overview)
Design Of A Usb Device Driver (Overview)
Usb In A Nutshell
Usb In A Nutshell
Introduction to SCSI over FCP for Linux on System z
Introduction to SCSI over FCP for Linux on System z
An1003 usb
An1003 usb
USB 3.0 CAPTURE HDMI 4K with Loop-through for Image redistribution
USB 3.0 CAPTURE HDMI 4K with Loop-through for Image redistribution
Алексей Мисник - USB устройства для пентеста
Алексей Мисник - USB устройства для пентеста
Usb in-a-nutshell
Usb in-a-nutshell
Chapter_2_CCNA2
Chapter_2_CCNA2
Networking with Linux on System z
Networking with Linux on System z
High Definition Fuzzing; Exploring HDMI vulnerabilities
High Definition Fuzzing; Exploring HDMI vulnerabilities
Paper id 252014121
Paper id 252014121
Advance of usb
Advance of usb
Xctu
Xctu
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Embedded I/O Management
Embedded I/O Management
“Automation Testing for Embedded Systems”
“Automation Testing for Embedded Systems”
Mehr von Tom Sun
Retrolambda+bolts
Retrolambda+bolts
Tom Sun
Pioc
Pioc
Tom Sun
Cloud radio 閃電秀
Cloud radio 閃電秀
Tom Sun
健康報告:德國飲食
健康報告:德國飲食
Tom Sun
iOs app 101
iOs app 101
Tom Sun
Whos Fault
Whos Fault
Tom Sun
小巫婆麗特拉
小巫婆麗特拉
Tom Sun
Serial Pnp
Serial Pnp
Tom Sun
Mehr von Tom Sun
(8)
Retrolambda+bolts
Retrolambda+bolts
Pioc
Pioc
Cloud radio 閃電秀
Cloud radio 閃電秀
健康報告:德國飲食
健康報告:德國飲食
iOs app 101
iOs app 101
Whos Fault
Whos Fault
小巫婆麗特拉
小巫婆麗特拉
Serial Pnp
Serial Pnp
Kürzlich hochgeladen
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Igalia
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
Delhi Call girls
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Drew Madelung
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
Michael W. Hawkins
Slack Application Development 101 Slides
Slack Application Development 101 Slides
praypatel2
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
Delhi Call girls
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
Enterprise Knowledge
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
Malak Abu Hammad
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
debabhi2
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
UK Journal
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
Radu Cotescu
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Miguel Araújo
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
Pixlogix Infotech
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
naman860154
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
The Digital Insurer
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
HampshireHUG
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
ThousandEyes
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
apidays
How to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
naman860154
Kürzlich hochgeladen
(20)
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
Slack Application Development 101 Slides
Slack Application Development 101 Slides
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
How to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
Linux usb2ether
1.
1
Linux USB to Ethernet development spec. overview kernel backend driver interfaces Copyright © 2009 by Tom J.P.Sun All rights reserved.
2.
2
USB Overview(1) USB 1.1/2.0 Spec. For S/W engineer: Chap 5 “USB Data Flow Model” Chap 9 “USB Device Framework” Chap 10 “USB Host : H/W and S/W” client function S/W Logical connection USB USB system device Physical H/W USB Bus USB Bus connection interface interface USB cable Copyright © 2009 by Tom J.P.Sun All rights reserved.
3.
3
USB Overview(2) client USB system Usbcore (bus driver) HC driver USB device F/W UHCI or OHCI USB device H/W USB bus HC H/W SIE Copyright © 2009 by Tom J.P.Sun All rights reserved.
4.
4
USB communication flow Communication Client S/W, driver flow buffers pipes Interface End points USB logical device Copyright © 2009 by Tom J.P.Sun All rights reserved.
5.
5
USB transfer types Control Transfer device enumeration use this type ( issued by USBD (bus driver)) client driver can use it ( same concept as “IOCTL”) for “device specific commands” Bulk Transfer reliable, but not realtime scanner,printer Isochronous Transfer near realtime, but not reliable usbcam Interrupt Transfer reliable, realtime, but limit in bandwidth mouse Important Concept cncpt USB is MasterSlave model USBOnTheGo is peertopeer model Copyright © 2009 by Tom J.P.Sun All rights reserved.
6.
6
USB Descriptor Hierarchy device descriptor Configuration Configuration 2 1 Interface 0 Interface 1 Interface 1 Interface 0 Interface 1 AS0 AS0 AS1 AS1 AS0 Endpoint Endpoint Endpoint More endpoint 1 2 3 descriptors Copyright © 2009 by Tom J.P.Sun All rights reserved.
7.
7
USB device request Copyright © 2009 by Tom J.P.Sun All rights reserved.
8.
8
USB standard commands (bRequest value) GET_STATUS 0 CLEAR_FEATURE 1 Reserved for future use 2 SET_FEATURE 3 Reserved for future use 4 SET_ADDRESS 5 GET_DESCRIPTOR 6 SET_DESCRIPTOR 7 GET_CONFIGURATION 8 SET_CONFIGURATION 9 GET_INTERFACE 10 SET_INTERFACE 11 SYNCH_FRAME 12 Copyright © 2009 by Tom J.P.Sun All rights reserved.
9.
9
9620 vendor commands (bRequest value) DM_READ_REGS 0 DM_WRITE_REGS 1 DM_READ_MEMS 2 DM_WRITE_REG 3 DM_WRITE_MEMS 5 DM_WRITE_MEM 7 Copyright © 2009 by Tom J.P.Sun All rights reserved.
10.
10
Configure Device When USB Device Plugged in, USBD + driver should complete the device enumeration steps 1 get dev descriptor dev descriptor 2 set address 3 get dev descriptor Host dev descriptor Device 4 set cfg 5 set itf 1 2 done by USBD CATC can see these transfers... 3 4 5 done by client Copyright © 2009 by Tom J.P.Sun All rights reserved.
11.
11
USB Core API Layers USB device USB device USB device driver driver driver upper API USBD = USB core ( usb.c ) lower API USB UHCI USB OHCI other USB driver driver HC driver ready Copyright © 2009 by Tom J.P.Sun All rights reserved.
12.
12
USB spec. overview kernel backend driver interfaces Copyright © 2009 by Tom J.P.Sun All rights reserved.
13.
13
USB driver structure(1) struct usb_driver { const char *name; void* (*probe) ( struct usb_interface * const struct usb_device_id *id_table); void (*disconnect) (struct usb_device *, void *); ... const struct usb_device_id *id_table; struct device_driver driver; }; @name: module name @probe: called to see if the driver will handle this USB interface , if it is, return zero, otherwise return a negative error code. @disconnect: called when the interface is no longer accessible. @id_table: USB use this table to support hotplugging, export this id_table with MODULE_DEVICE_TABLE( ) macro. @driver: driver modle core driver structure Copyright © 2009 by Tom J.P.Sun All rights reserved.
14.
14
USB driver structure(2) On device attachment, USB framework walk USBD through the id_table usb_register( ) First enter point on device match usb_driver my_probe( ) … my_disconnect( ) … id_table : match list 1st match dev 2nd match dev … On device detachment, USB framework call this. Copyright © 2009 by Tom J.P.Sun All rights reserved.
15.
15
Standard Commands USBD provides USB standard commands usb_set_configuration( struct usb_device* dev, int cfg); usb_set_interface(struct usb_device*, int itf, int alt); usb_get_descriptor(…); usb_get_string(…); usb_get_status(…); kenrel_source/drivers/usb/core/message.c Copyright © 2009 by Tom J.P.Sun All rights reserved.
16.
16
The USB data path Can isolate driver, when proving h/w App App Linux O.S. Interface Network FS (TCP/IP) App open the usb device interface, direct transfer data to the USB HC In PCI USB Kernel subsystem subsystem App open socket, data transferred by Network and USB PCI USB driver driver driver H/W EtherNet PCI USB EtherNet Chip bus HC Chip Copyright © 2009 by Tom J.P.Sun All rights reserved.
17.
17
The usbnet minidriver The mini-driver interface ... Network tx_fixup( ) (TCP/IP) rx_fixup( ) ... asix usbnet dm9601 driver framework ...other The usbnet module manages: client drivers 1. skb flow control with the Network layer 2. urb flow control with the USB bus driver The mini-driver only take simple work for device-specific fixups. so, the performance issue should be little between each mini-driver, (Yes ! performance depends major on the H/W) Copyright © 2009 by Tom J.P.Sun All rights reserved.
18.
18
USB spec. overview kernel backend driver interfaces Copyright © 2009 by Tom J.P.Sun All rights reserved.
19.
19
dm9601_rx_fixup( ) Object: correct the contents of skb ( data for the network layer ), which is device specific. e.g. dm9620 h/w give us data with length in the first 2 bytes, rx_fixup( ) should remove it before passing to the network layer Mini-driver interface static const struct driver_info dm9601_info = { .description = "Davicom DM9601 USB Ethernet", .flags = FLAG_ETHER, .bind = dm9601_bind, .rx_fixup = dm9601_rx_fixup, .tx_fixup = dm9601_tx_fixup, .status = dm9601_status, .link_reset = dm9601_link_reset, .reset = dm9601_link_reset, }; Copyright © 2009 by Tom J.P.Sun All rights reserved.
20.
20
dm9601_tx_fixup( ) Object: correct the contents of skb ( data for the network layer ), which is device specific. e.g. dm9620 h/w need data with length in the first 2 bytes, tx_fixup( ) should add it before passing to the chip static const struct driver_info dm9601_info = { .description = "Davicom DM9601 USB Ethernet", .flags = FLAG_ETHER, .bind = dm9601_bind, .rx_fixup = dm9601_rx_fixup, .tx_fixup = dm9601_tx_fixup, .status = dm9601_status, .link_reset = dm9601_link_reset, .reset = dm9601_link_reset, }; Copyright © 2009 by Tom J.P.Sun All rights reserved.
21.
21
vendor commands(1) static int dm_read(struct usbnet *dev, u8 reg, u16 length, void *data) { devdbg(dev, "dm_read() reg=0x%02x length=%d", reg, length); return usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0), DM_READ_REGS, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 0, reg, data, length, USB_CTRL_SET_TIMEOUT); } Copyright © 2009 by Tom J.P.Sun All rights reserved.
22.
22
vendor commands (2) static int dm_write(struct usbnet *dev, u8 reg, u16 length, void *data) { return usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0), DM_WRITE_REGS, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 0, reg, data, length, USB_CTRL_SET_TIMEOUT); } Concept: The vendor commands are used to setup h/w , while the real data are transferred by b-in , b-out pipes, not the control pipe. Copyright © 2009 by Tom J.P.Sun All rights reserved.
23.
23
Device ID & Vendor ID u s e Use this information to load driver when plug-in... Copyright © 2009 by Tom J.P.Sun All rights reserved.
24.
24
Appendix : libusb Bypass driver, direct call via the USB subsystem. Package 0.1.12 (simple, but not well support thread ) we need header files: #> apt-get src libusb-dev (get libusb-0.1.12 under the same directory) Makefile: usbtest: usbtest.c gcc -g -Wall $< -o $@ -I./libusb-0.1.12 -lusb ( assume usbtest.c is the our test program using the libusb , use root to test...) Copyright © 2009 by Tom J.P.Sun All rights reserved.
25.
25
Example usage of libusb (1) Include headers: #include "linux.h" #include "usbi.h" Initial setup provided by libusb usb_init(); usb_find_busses(); usb_find_devices(); Copyright © 2009 by Tom J.P.Sun All rights reserved.
26.
26
Example usage of libusb (2) Get our device: for (usb_bus = usb_busses; usb_bus; usb_bus = usb_bus->next) { for (dev = usb_bus->devices; dev; dev = dev->next) { if ((dev->descriptor.idVendor == VENDOR_ID) && (dev->descriptor.idProduct == PRODUCT_ID)) return dev; } } Copyright © 2009 by Tom J.P.Sun All rights reserved.
27.
27
Example usage of libusb (3) Open: usb_handle = usb_open(usb_dev); B-out: mk_raw(buf, SZBUF); /* prepare data in buf*/ retval = usb_bulk_write(usb_handle, ep_bulk_out, (char*)buf, SZBUF, 5000); B-in: memset(buf, 0, SZBUF); retval = usb_bulk_read(usb_handle, ep_bulk_in, (char*)buf, SZBUF, 5000); Copyright © 2009 by Tom J.P.Sun All rights reserved.
28.
28
Example usage of libusb (4) Control pipe: usb_control_msg(handle, 0x000000c0, DM_READ_REGS, 0,0xff & reg,data,length,5000); prototype: libusb-0.1.12/linux.c int usb_control_msg( usb_dev_handle *dev, int requesttype, int request, int value, int index, char *bytes, int size, int timeout); Copyright © 2009 by Tom J.P.Sun All rights reserved.
29.
29
The End Copyright © 2009 by Tom J.P.Sun All rights reserved.
Jetzt herunterladen