Re: question about Template for f_mass_storage.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 6 Oct 2011, loody wrote:

> 1. when below source will be executed? it seems the context will
> always not be filled in.
> ( I temporarily remove that and program runs well.)
>  if (req->status == 0 && req->context)
>                 ((fsg_routine_t) (req->context))(fsg);

This is in ep0_complete(), right?  Therefore it will be executed each
time a transfer on ep0 completes.  However, req->context will always be
NULL unless you enable the CBI or CB protocol by setting the
transport=CBI or transport=CB module parameter -- see the 
USB_CBI_ADSC_REQUEST case in class_setup_req().

>  2. in following source code, it is possible process will fall in ***
>  loop if the state in start_transfer be EMPTY, when queue failed,
>  right?
>  if that really happen, who or when the process will leave ***?
> 
>                 start_transfer(fsg, fsg->bulk_out, bh->outreq,
>                                 &bh->outreq_busy, &bh->state);
> 
>                 /* We will drain the buffer in software, which means we
>                  * can reuse it for the next filling.  No need to advance
>                  * next_buffhd_to_fill. */
> 
>                 /* Wait for the CBW to arrive */
>  ****       while (bh->state != BUF_STATE_FULL) {
>                         rc = sleep_thread(fsg);
>                         if (rc)
>                                 return rc;

This is in get_next_command(), right?  What do you mean by "queue 
failed"?

If the host doesn't send a command, the loop will end when
sleep_thread() returns -EINTR.  This can happen for a few reasons: The
gadget could be disconnected, it could be reset, or the module could be
unloaded.

>  3. in http://www.mail-archive.com/linux-usb-devel@xxxxxxxxxxxxxxxxxxxxx/msg15529.html
> , it mentioned about Scsi-backed Storage Gadget, I cannot find it in
> the gadget file folder.Is that
>  finally realized?

No, and I doubt that it will ever be written.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux