On Sat, 2006-08-19 at 10:45 -0400, Alan Stern wrote: > On Sat, 19 Aug 2006, Peter.Chen wrote: > > > thx Alan > > > > My host linux kernel is 2.6.11.10.is it old kernel or recent one? > > and what causes the port reset fails?software's or hardware's? > > Everything before 2.6.13 counts as an old kernel, so your kernel uses bulk > reset requests. Generally, port reset failures are caused by hardware, > not software. > > > yeah,i never get SETUP 21.ff v0000 i0000 l0000 at Windows host. > > > > But at WindowsXP host,i can get > > g_file_storage gadget: bulk_out_complete --> -104 > > At that situation,i read CBW.The CBW is error. > > 0: 00 1e 45 ff 00 00 02 00 08 00 00 00 80 00 0a 25 > > 10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 > > The -104 means the request was cancelled, so of course the CBW is invalid. I wouder what causes -104 error?I have a question,the error received error CBW causes -104 error,or -104 error causes it receives error CBW? I find if it receives error CBW,the copy will be aborted after the host tries several resets. the debugging log are as belows: NOTE: I print last three setup packets when it enters my dm320_de_dequeue function.I save my register value,req->buf,req->acutal at bulk_out_complete,and i print CBW and registers value at static int fsg_main_thread(void *fsg_) while (fsg->state != FSG_STATE_TERMINATED) { if (exception_in_progress(fsg) || signal_pending(current)) { printk("the dma ctrl1 is 0x%x\n",usb_ctrl1); printk("the dma ctrl2 is 0x%x\n",usb_ctrl2); printk("the usb intr is 0x%x\n",usb_intr); debug_msg(debug_buf,debug_length); printk("the fsg->state is %d\n",fsg->state ); handle_exception(fsg); continue; } .... } I think after that way,i can get the last CBW,when the fsg enter exception.The registers value are ok.
standard_setup_req:1536> at USB_REQ_SET_CONFIGURATION(at file_storage.c) the dma ctrl1 is 0x81a the dma ctrl2 is 0x818 the usb intr is 0x0 the length is 31 0: 55 53 42 43 10 79 04 82 00 00 01 00 80 00 0a 28 10: 00 00 10 22 6f 00 00 80 00 00 00 00 00 00 00 the fsg->state is 4 dm320_ep_dequeue:1095> at the function.......... print_setup_packet:124> SETUP 80.06 v0100 i0012 l0100 print_setup_packet:127> SETUP 80.06 v0200 i0009 l0200 print_setup_packet:130> SETUP 00.09 v0001 i0000 l0001 g_file_storage gadget: bulk_out_complete --> -104, 0/31 g_file_storage gadget: reset config do_set_config:3405> reset config g_file_storage gadget: reset interface do_set_interface:3301> reset interface dm320_free_request:356> at the dm320_free_request dm320_free_request:356> at the dm320_free_request dm320_free_request:356> at the dm320_free_request dm320_free_request:356> at the dm320_free_request dm320_ep_disable:299> at the dm320_ep_disable dm320_ep_disable:299> at the dm320_ep_disable g_file_storage gadget: set interface 0 do_set_interface:3342> set interface 0 dm320_ep_enable:157> at the dm320_ep_enable dm320_ep_enable:157> at the dm320_ep_enable dm320_alloc_request:341> dm320_alloc_request, c0dfe134 dm320_alloc_request:341> dm320_alloc_request, c0dfe1a8 dm320_alloc_request:341> dm320_alloc_request, c0dfe134 dm320_alloc_request:341> dm320_alloc_request, c0dfe1a8 g_file_storage gadget: full speed config #1 dm320_ep_queue:935> at udc->ep0_set_config dm320_ep_queue:946> at !udc->ep0_reset_config check_command:2872> the error is here, ****************** Before enter below statement,unit_attention_data=SS_RESET_OCCURRED; /* If a unit attention condition exists, only INQUIRY and * REQUEST SENSE commands are allowed; anything else must fail. */ if (curlun && curlun->unit_attention_data != SS_NO_SENSE && fsg->cmnd[0] != SC_INQUIRY && fsg->cmnd[0] != SC_REQUEST_SENSE) { dbg("curlun->unit_attention_data is %x\n",curlun- >unit_attention_data); curlun->sense_data = curlun->unit_attention_data; curlun->unit_attention_data = SS_NO_SENSE; dbg("the error is here\n"); return -EINVAL; } ****************** do_scsi_command:3113> the reply is -22 g_file_storage gadget: sending command-failure status C.W¹‘…É‘}Í•ÑÕÁ}É•Åé1536> at USB_REQ_SET_CONFIGURATION do_scsi_command:3116> the reply is 8,then return -EINTR The function will return at below condition: ******************* if (reply == -EINTR || signal_pending(current)){ dbg("the reply is %d,then return -EINTR\n",reply); return -EINTR; } ********************************** the dma ctrl1 is 0x81a the dma ctrl2 is 0x818 the usb intr is 0x0 the length is 31 0: 00 1e 45 ff 00 00 02 00 08 00 00 00 80 00 0a 25 10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 the fsg->state is 4 g_file_storage gadget: reset config do_set_config:3405> reset config g_file_storage gadget: reset interface do_set_interface:3301> reset interface dm320_free_request:356> at the dm320_free_request dm320_free_request:356> at the dm320_free_request dm320_free_request:356> at the dm320_free_request dm320_free_request:356> at the dm320_free_request dm320_ep_disable:299> at the dm320_ep_disable dm320_ep_disable:299> at the dm320_ep_disable g_file_storage gadget: set interface 0 do_set_interface:3342> set interface 0 dm320_ep_enable:157> at the dm320_ep_enable dm320_ep_enable:157> at the dm320_ep_enable dm320_alloc_request:341> dm320_alloc_request, c0dfe134 dm320_alloc_request:341> dm320_alloc_request, c0dfe1a8 dm320_alloc_request:341> dm320_alloc_request, c0dfe134 dm320_alloc_request:341> dm320_alloc_request, c0dfe1a8 g_file_storage gadget: full speed config #1 dm320_ep_queue:935> at udc->ep0_set_config dm320_ep_queue:946> at !udc->ep0_reset_config standard_setup_req:1536> at USB_REQ_SET_CONFIGURATION check_command:2872> the error is here do_scsi_command:3113> the reply is -22 do_scsi_command:3116> the reply is -22,then return -EINTR the dma ctrl1 is 0x81a the dma ctrl2 is 0x818 the usb intr is 0x0 the length is 31 0: 55 53 42 43 68 ea dd 81 00 00 01 00 80 00 0a 28 10: 00 00 18 ef ef 00 00 80 00 00 00 00 00 00 00 the fsg->state is 4 g_file_storage gadget: reset config do_set_config:3405> reset config g_file_storage gadget: reset interface do_set_interface:3301> reset interface dm320_free_request:356> at the dm320_free_request dm320_free_request:356> at the dm320_free_request dm320_free_request:356> at the dm320_free_request dm320_free_request:356> at the dm320_free_request dm320_ep_disable:299> at the dm320_ep_disable dm320_ep_disable:299> at the dm320_ep_disable g_file_storage gadget: set interface 0 do_set_interface:3342> set interface 0 dm320_ep_enable:157> at the dm320_ep_enable dm320_ep_enable:157> at the dm320_ep_enable dm320_alloc_request:341> dm320_alloc_request, c0dfe134 dm320_alloc_request:341> dm320_alloc_request, c0dfe1a8 dm320_alloc_request:341> dm320_alloc_request, c0dfe134 dm320_alloc_request:341> dm320_alloc_request, c0dfe1a8 g_file_storage gadget: full speed config #1 dm320_ep_queue:935> at udc->ep0_set_config dm320_ep_queue:946> at !udc->ep0_reset_config standard_setup_req:1536> at USB_REQ_SET_CONFIGURATION check_command:2872> the error is here do_scsi_command:3113> the reply is -22 do_scsi_command:3116> the reply is -22,then return -EINTR the dma ctrl1 is 0x81a the dma ctrl2 is 0x818 the usb intr is 0x0 the length is 31 0: 55 53 42 43 e0 55 d7 81 08 00 00 00 80 00 0a 25 10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 the fsg->state is 4 g_file_storage gadget: reset config do_set_config:3405> reset config g_file_storage gadget: reset interface do_set_interface:3301> reset interface dm320_free_request:356> at the dm320_free_request dm320_free_request:356> at the dm320_free_request dm320_free_request:356> at the dm320_free_request dm320_free_request:356> at the dm320_free_request dm320_ep_disable:299> at the dm320_ep_disable dm320_ep_disable:299> at the dm320_ep_disable g_file_storage gadget: set interface 0 do_set_interface:3342> set interface 0 dm320_ep_enable:157> at the dm320_ep_enable dm320_ep_enable:157> at the dm320_ep_enable dm320_alloc_request:341> dm320_alloc_request, c0dfe134 dm320_alloc_request:341> dm320_alloc_request, c0dfe1a8 dm320_alloc_request:341> dm320_alloc_request, c0dfe134 dm320_alloc_request:341> dm320_alloc_request, c0dfe1a8 g_file_storage gadget: full speed config #1 dm320_ep_queue:935> at udc->ep0_set_config dm320_ep_queue:946> at !udc->ep0_reset_config standard_setup_req:1536> at USB_REQ_SET_CONFIGURATION check_command:2872> the error is here do_scsi_command:3113> the reply is -22 do_scsi_command:3116> the reply is -22,then return -EINTR the dma ctrl1 is 0x81a the dma ctrl2 is 0x818 the usb intr is 0x0 the length is 31 0: 55 53 42 43 e0 55 d7 81 08 00 00 00 80 00 0a 25 10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 the fsg->state is 4 g_file_storage gadget: reset config do_set_config:3405> reset config g_file_storage gadget: reset interface do_set_interface:3301> reset interface dm320_free_request:356> at the dm320_free_request dm320_free_request:356> at the dm320_free_request dm320_free_request:356> at the dm320_free_request dm320_free_request:356> at the dm320_free_request dm320_ep_disable:299> at the dm320_ep_disable dm320_ep_disable:299> at the dm320_ep_disable g_file_storage gadget: set interface 0 do_set_interface:3342> set interface 0 dm320_ep_enable:157> at the dm320_ep_enable dm320_ep_enable:157> at the dm320_ep_enable dm320_alloc_request:341> dm320_alloc_request, c0dfe134 dm320_alloc_request:341> dm320_alloc_request, c0dfe1a8 dm320_alloc_request:341> dm320_alloc_request, c0dfe134 dm320_alloc_request:341> dm320_alloc_request, c0dfe1a8 g_file_storage gadget: full speed config #1 dm320_ep_queue:935> at udc->ep0_set_config dm320_ep_queue:946> at !udc->ep0_reset_config standard_setup_req:1536> at USB_REQ_SET_CONFIGURATION check_command:2872> the error is here do_scsi_command:3113> the reply is -22 do_scsi_command:3116> the reply is -22,then return -EINTR the dma ctrl1 is 0x81a the dma ctrl2 is 0x818 the usb intr is 0x0 the length is 31 0: 55 53 42 43 68 ea dd 81 00 00 01 00 80 00 0a 28 10: 00 00 18 ef ef 00 00 80 00 00 00 00 00 00 00 the fsg->state is 4 g_file_storage gadget: reset config do_set_config:3405> reset config g_file_storage gadget: reset interface do_set_interface:3301> reset interface dm320_free_request:356> at the dm320_free_request dm320_free_request:356> at the dm320_free_request dm320_free_request:356> at the dm320_free_request dm320_free_request:356> at the dm320_free_request dm320_ep_disable:299> at the dm320_ep_disable dm320_ep_disable:299> at the dm320_ep_disable g_file_storage gadget: set interface 0 do_set_interface:3342> set interface 0 dm320_ep_enable:157> at the dm320_ep_enable dm320_ep_enable:157> at the dm320_ep_enable dm320_alloc_request:341> dm320_alloc_request, c0dfe134 dm320_alloc_request:341> dm320_alloc_request, c0dfe1a8 dm320_alloc_request:341> dm320_alloc_request, c0dfe134 dm320_alloc_request:341> dm320_alloc_request, c0dfe1a8 g_file_storage gadget: full speed config #1 dm320_ep_queue:935> at udc->ep0_set_config dm320_ep_queue:946> at !udc->ep0_reset_config standard_setup_req:1536> at USB_REQ_SET_CONFIGURATION check_command:2872> the error is here do_scsi_command:3113> the reply is -22 do_scsi_command:3116> the reply is -22,then return -EINTR the dma ctrl1 is 0x81a the dma ctrl2 is 0x818 the usb intr is 0x0 the length is 31 0: 55 53 42 43 e0 55 d7 81 08 00 00 00 80 00 0a 25 10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 the fsg->state is 4 g_file_storage gadget: reset config do_set_config:3405> reset config g_file_storage gadget: reset interface do_set_interface:3301> reset interface dm320_free_request:356> at the dm320_free_request dm320_free_request:356> at the dm320_free_request dm320_free_request:356> at the dm320_free_request dm320_free_request:356> at the dm320_free_request dm320_ep_disable:299> at the dm320_ep_disable dm320_ep_disable:299> at the dm320_ep_disable g_file_storage gadget: set interface 0 do_set_interface:3342> set interface 0 dm320_ep_enable:157> at the dm320_ep_enable dm320_ep_enable:157> at the dm320_ep_enable dm320_alloc_request:341> dm320_alloc_request, c0dfe134 dm320_alloc_request:341> dm320_alloc_request, c0dfe1a8 dm320_alloc_request:341> dm320_alloc_request, c0dfe134 dm320_alloc_request:341> dm320_alloc_request, c0dfe1a8 g_file_storage gadget: full speed config #1 dm320_ep_queue:935> at udc->ep0_set_config dm320_ep_queue:946> at !udc->ep0_reset_config standard_setup_req:1536> at USB_REQ_SET_CONFIGURATION check_command:2872> the error is here do_scsi_command:3113> the reply is -22 do_scsi_command:3116> the reply is -22,then return -EINTR the dma ctrl1 is 0x81a the dma ctrl2 is 0x818 the usb intr is 0x0 the length is 31 0: 55 53 42 43 68 ea dd 81 00 00 01 00 80 00 0a 28 10: 00 00 18 ef ef 00 00 80 00 00 00 00 00 00 00 the fsg->state is 4 g_file_storage gadget: reset config do_set_config:3405> reset config g_file_storage gadget: reset interface do_set_interface:3301> reset interface dm320_free_request:356> at the dm320_free_request dm320_free_request:356> at the dm320_free_request dm320_free_request:356> at the dm320_free_request dm320_free_request:356> at the dm320_free_request dm320_ep_disable:299> at the dm320_ep_disable dm320_ep_disable:299> at the dm320_ep_disable g_file_storage gadget: set interface 0 do_set_interface:3342> set interface 0 dm320_ep_enable:157> at the dm320_ep_enable dm320_ep_enable:157> at the dm320_ep_enable dm320_alloc_request:341> dm320_alloc_request, c0dfe134 dm320_alloc_request:341> dm320_alloc_request, c0dfe1a8 dm320_alloc_request:341> dm320_alloc_request, c0dfe134 dm320_alloc_request:341> dm320_alloc_request, c0dfe1a8 g_file_storage gadget: full speed config #1 dm320_ep_queue:935> at udc->ep0_set_config dm320_ep_queue:946> at !udc->ep0_reset_config After above log,the copy is aborted. > > Almost,i get above error when i read the data from device to host > > and after get above error,the copy will abort. > > But i can go on read the data from the device to host. > > I don't understand. How can you go on to read data from the device to the > host if the device has aborted and isn't sending any data? Do you mean > that you can start another copy and it will work? I mean the copy is aborted,just like descirbing above.But i can start another copy,and it will work.The windowsXP hosts print "The param is incorrect". > > usually,the next read from device is right. > > and i get such error after copy data 5-6 hours(a batch at windows,one > > read+one write....). > > Now,i wonder is it software error or hardware error? > > if software's,what causes it? > > I can't tell for sure without seeing the debugging log from > g_file_storage. If it occurs after 5-6 hours then it's probably a > hardware error. The debugging log i gave u above.Thank u for look at it . Sign,it really hard to find where the problem really is. In my device,there are 2 media,SD card and NAND Flash. I write and read NAND FLASH through usb is OK.(after more than half days test).I copy data to(from) SD Card using network are also ok(without usb,using hard disk,NFS) But when conterns to usb,the SD card copy is error. The frequency is several hours (from 2 to 7). And i find the fsg status can back to normal after dm320_eq_dequeue at USB enumeration.The logs are belows: at USB_REQ_SET_CONFIGURATION g_file_storage gadget: set configuration g_file_storage gadget: ep0-setup, length 8: g_file_storage gadget: get string descriptor g_file_storage gadget: ep0-in, length 62: g_file_storage gadget: ep0-setup, length 8: g_file_storage gadget: get string descriptor g_file_storage gadget: ep0-in, length 54: the dma ctrl1 is 0x81a the dma ctrl2 is 0x819 the usb intr is 0x0 g_file_storage gadget: ep0-setup, length 8: g_file_storage gadget: get string descriptor g_file_storage gadget: ep0-in, length 26: g_file_storage gadget: ep0-setup, length 8: g_file_storage gadget: get max LUN g_file_storage gadget: ep0-in, length 1: the length is 13 0: 55 53 42 53 cb 5b 00 00 00 00 00 00 00 the fsg->state is 4 dm320_ep_dequeue:1095> at the function.......... print_setup_packet:124> SETUP 80.06 v0302 i00ff l0302 print_setup_packet:127> SETUP 80.06 v0303 i00ff l0303 print_setup_packet:130> SETUP a1.fe v0000 i0001 l0000 g_file_storage gadget: bulk-out, length 0: g_file_storage gadget: bulk_out_complete --> -104, 0/31 g_file_storage gadget: reset config g_file_storage gadget: reset interface dm320_free_request:356> at the dm320_free_request dm320_free_request:356> at the dm320_free_request dm320_free_request:356> at the dm320_free_request dm320_free_request:356> at the dm320_free_request dm320_ep_disable:299> at the dm320_ep_disable dm320_ep_disable:299> at the dm320_ep_disable g_file_storage gadget: set interface 0 g_file_storage gadget: full speed config #1 g_file_storage gadget: ep0-setup, length 8: g_file_storage gadget: get string descriptor g_file_storage gadget: ep0-in, length 26: g_file_storage gadget: ep0-setup, length 8: g_file_storage gadget: get string descriptor g_file_storage gadget: ep0-in, length 26: But when concerns the date transfer,just like the first debugging log,it can't back to normal after dequeue function. I have a question,there is an error occurs when the usb is transfering data,the usb status (fsg status) can back to normal or not? I think they can,my dequeue function mostly follows pxa_udc's.The function are as belows: static void cancel_dma(struct dm320_ep *ep) { if (list_empty(&ep->queue)) return; cpu_relax(); /* here we just Flush FIFO */ if (ep->bEndpointAddress & USB_DIR_IN){ if(!(readb(USB_PER_TXCSR1) & USB_TXCSR1_FIFOEMP)){ writeb(readb(USB_PER_TXCSR1) | USB_TXCSR1_FLFIFO,USB_PER_TXCSR1); if(ep->double_buf){ writeb(readb(USB_PER_TXCSR1) | USB_TXCSR1_FLFIFO,USB_PER_TXCSR1); } } printk("list_empty(&ep->queue) is not true.....\r\n"); } return; } static int dm320_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req) { struct dm320_ep *ep = container_of(_ep, struct dm320_ep, ep); struct dm320_req *req; unsigned long flags; INFO("at the function..........\r\n"); if (!_ep || !_req) return -EINVAL; print_setup_packet(); spin_lock_irqsave(&ep->udc->lock, flags); /* make sure it's actually queued on this endpoint */ list_for_each_entry (req, &ep->queue, queue) { if (&req->req == _req) break; } if (&req->req != _req) { spin_unlock_irqrestore(&ep->udc->lock, flags); return -EINVAL; } /* maybe i need to do some dma functions--peter */ if (use_dma && ep->has_dma && ep->queue.next == &req->queue && !ep->stopped) { cancel_dma(ep); INFO("after cancel_dma(ep)\n"); done(ep, req, -ECONNRESET); if (!list_empty(&ep->queue)) { req = list_entry(ep->queue.next, struct dm320_req, queue); kick_dma(ep, req); } } else done(ep, req, -ECONNRESET); spin_unlock_irqrestore(&ep->udc->lock, flags); return 0; } > Alan Stern > Looking forword to ur reply.Thx:) ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ linux-usb-devel@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel