LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Password
Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.

Notices


Reply
  Search this Thread
Old 05-15-2022, 08:28 AM   #1
Doerthous
LQ Newbie
 
Registered: May 2022
Posts: 2

Rep: Reputation: 0
Question Does usb support control (IN) transfer with wLength = 0?


Recently, I'm learning usb protocol with libusb and linux gadget (g_zero). When I do the following control transfer, the usb device just stucks.

Code:
libusb_control_transfer(devh
  0xC0, // bRequestType (IN, device to host)
  0x5C, // bRequest
  0x0000, // wValue
  0x0000, // wIndex
  NULL, // buffer
  0, // buffer length
  1000 // timeout
)
I also use a usb analyzer to monitor the usb packets, it show as follow:

Code:
Setup Stage:
    SETUP Packet
    DATA0 Packet: c0 5c 00 00 00 00 00 00
    ACK Packet
Data Stage:
    nothing here, then follow immediately with
Status Stage:
    OUT Packet
    DATA1 Packet (length: 0)
    NAK Packet 
PING Packet // then PING Packet infinitely
After that, I search the usb 2.0 specification and found (in ch 8.5.3) that the specification describes only three type of control transfer:

Code:
             Setup                      Data                      Status
             Stage                      Stage                     Stage
            /---------\  /------------------------------------\  /-------\
Control     <Setup (0)>  <Out (1)>  <Out (0)>  ...  <Out (0/1)>  <In  (1)>
Write           DATA0      DATA1      DATA0           DATA0/1      DATA1

Control     <Setup (0)>  <In  (1)>  <In  (0)>  ...  <In  (0/1)>  <Out (1)>
Read            DATA0      DATA1      DATA0           DATA0/1      DATA1

             Setup        Status
             Stage        Stage
            /---------\  /-------\
No-Data     <Setup (0)>  <IN  (1)>
Control         DATA0      DATA1
So I guess maybe usb doesn't support Ctrl-IN-0 transfer?

https://stackoverflow.com/questions/...with-wlength-0
 
Old 05-18-2022, 08:03 AM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,149

Rep: Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264
Even if its supported by the standard, I doubt anyone tests for it.
 
Old 06-09-2022, 08:38 PM   #3
Doerthous
LQ Newbie
 
Registered: May 2022
Posts: 2

Original Poster
Rep: Reputation: 0
I noticed that the standard seem like not mention the situation. So, I guess this is an implement-dependent or undefined behavior. I will let go the problem.

Last edited by Doerthous; 06-09-2022 at 10:26 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
No transfer process shown during USB transfer mad.slacker Slackware 6 01-23-2010 03:48 PM
tc traffic control tc traffic control Linux QoS control tool(noob help) inv|s|ble Linux - General 1 07-26-2007 11:12 AM
Music transfer software for MP3 players using Media Transfer Protocol commandante Linux - Software 2 06-26-2007 11:09 PM
xp 2 linux data transfer when kernal does not support ntfs TheDisciple Linux - Newbie 8 08-31-2004 03:43 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer

All times are GMT -5. The time now is 09:33 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration