# usbd_transfer_setup() returning USB_ERR_NO_PIPE



## Farhan Khan (Feb 20, 2022)

Hi all,
I am trying to attach a USB device with the usbd_transfer_setup() during the attach() stage, but am getting a kernel message saying USB_ERR_NO_PIPE.
I traced this back in the kernel to sys/dev/usb/usb_transfer.c line 1156. There are a series of check-conditions that ultimately return USB_ERR_NO_PIPE. I do not know what USB_ERR_NO_PIPE means.

My questions are:

What does this error message mean? What is happening that is causing this condition to arise?
How would I instrument with dtrace to identify the values being compared to identify the issue? I have not been able to figure out the dtrace magic necessary to print the struct in a human-readable way. (I would love to include the struct as we do in C without having to replicate it in a dtrace script, but have not figured out how to do that.)
Short of adding a series of printfs, I am not sure how to debug this or what this even means.
Please advise. Thanks!


----------



## mark_j (Feb 21, 2022)

No disrespect meant, but you're working with kernel driver code and you don't know what USB_ERR_NO_PIPE means?
Succinctly, it means there's an error in the TCB. What error, I don't know because it's all about context and I have no time to read your indicated code, sorry.
I wonder what you have set for the *type* element in the _*usb_config*_ structure or perhaps you can just set the *flags* element to *no_pipe_ok* and your error will disappear?

You may want to read up about xhci?

Oh, and there's no need for dtrace until you suspect this is an error in the usb driver code/API rather than an EDOOFUS. 

Edit:  There's always the mailing list of freebsd-usb and freebsd-drivers to ask questions if you are developing a driver.


----------



## Andriy (Feb 21, 2022)

Post _your_ source code to usb@freebsd.org


----------

