LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 08-14-2012, 10:06 PM   #1
sarmads1
LQ Newbie
 
Registered: Jul 2012
Location: ca
Posts: 4

Rep: Reputation: Disabled
set feature halt endpoint fails always USB linux driver usb gadget serial dot c


Hello Kernel lovers.
I have an issue of my 2.6.10 embedded Linux
My USB bus is S3C2410, samsung, and my processor is ARM
http://www.wvshare.com/datasheet_html/S3C2410-PDF.html

I am trying to place a "stall" over the USB bus in Linux over the file linux/drivers/usb/gadget/serial.c.

I added set_feature, clear_feature and get_status requests from include/linux/usb.h & usb_gadget.h.
I am intending to use the functions (queue, dequeue, set&clear halt etc in the header file here)
http://lxr.free-electrons.com/ident?i=usb_ep_set_halt

I am supposing set_halt (if returned 0) will set halt on an endpoint - but it is not.
I tried this
if ((ctrl->brequest==SET_FEATURE) && (ctrl->brecepient == endpoint && 0xf))//MASK - 5 endpoints, I receive 0x80 + endpoint is direction in, 0x00 + endpoint direction out
then
1- I tried:
usb_ep_fifo_flush(ep); //so set_ep_halt succeeds, we need to dequeue, but I am flushing totally
ret = usb_ep_halt (ep); //ret is 0 as I see on debug files
status[endpoint_number] = 0;
On log file, I see endp = 2 or 3, direction in or out and ret = 0

2- I tried:
from USB samsung manual above, page 13-9
USB dev controller special index register:
place the index of an endpoint into the index register, and send value to the hardware according to page 13-12 and 13-13
spinlock(&device);
set_index_reg_value (brecepient & 0xf); //to program the endpoint's index register
u32 value = read (EP0_CSR);
value = value | SERVICED_OUT_PKT_RDY; //clear OUT_PKT_RDY bit 0
value = value | SEND_STALL; // placing this MUST stall by hw
write (EP0_CSR, value);
spinunlock(&device);

On clear_halt, I read the same value that I placed last time when set, which means, my write is successful and consistent.

BUT
But running the ch9 test
http://www.usb.org/developers/tools/

tells me ALWAYS that
Endpoint halt failed for 83
cleared stall 83
Endpoint halt failed for 82
cleared stall on 82
Endpoint halt failed for 1
cleared stall on 1
A device that has Bulk/Interrupt endpoints must support the Halt Endpoint request on those endpoints
failure
I tried http://www.cygnal.org/ubb/Forum9/HTML/001749.html
and changed the interval into 0x8, 0x10, etc, but the test is still consistent on bothering me for a week!!

on my custom structure (gadget_usb_driver) I have 2 endpoints only not 5 (marked as 0x80 in, 0x0 out)
but I cheat with the number bEndpointAddress 0x80 + 1 / + 2 / +3 now and then
Still it fails all the tests 83, 82 and 1, which means it is IRRELATED to the number bEndpointAddress.
please help if you know where I am failing.
Could it be (delay) addition because serial is too slow?
Or must I insert other endpoints and initialize them, bind them and etc?
Or I am programming wrong hardware?
Or any other hint that I am missing?
Is it endianness in ARM? I dont believe so
thank you
 
  


Reply

Tags
usb serial


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
About USB Gadget serial driver sdefayette Linux - General 1 08-12-2012 11:41 AM
Linux usb gadget HID driver problem Sebteams69 Linux - Newbie 7 06-12-2012 02:24 PM
USB Gadget control endpoint processing to handle vendor specific requests ndno Linux - Embedded & Single-board computer 0 06-27-2011 05:38 AM
usb gadget printer driver application grsandeep85 Programming 1 08-18-2010 01:24 AM
Problems with USB Gadget driver when host is windows VGM Linux - Newbie 2 07-07-2010 11:45 PM


All times are GMT -5. The time now is 03:01 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration