Hi Greg 2016-12-08 19:40 GMT+09:00 Greg KH <gre...@linuxfoundation.org>: > On Thu, Dec 08, 2016 at 05:20:28PM +0900, Jae Joong Kim wrote: >> Hi Greg >> >> I think 'urb->transfer_flags' also has URB_ZERO_PACKET flag to handle >> the data is aligned to an endpoint packet boundary. >> >> How do you think this change? >> >> diff --git a/drivers/usb/usb-skeleton.c b/drivers/usb/usb-skeleton.c >> index 5133a07..e5c9261b 100644 >> --- a/drivers/usb/usb-skeleton.c >> +++ b/drivers/usb/usb-skeleton.c >> @@ -432,7 +432,7 @@ static ssize_t skel_write(struct file *file, const >> char *user_buffer, >> usb_fill_bulk_urb(urb, dev->udev, >> usb_sndbulkpipe(dev->udev, >> dev->bulk_out_endpointAddr), >> buf, writesize, skel_write_bulk_callback, dev); >> - urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; >> + urb->transfer_flags = URB_NO_TRANSFER_DMA_MAP | URB_ZERO_PACKET; > > Well, the patch is line-wrapped and whitespace is broken, so it doesn't > apply, so of course I don't like the patch :) > > But, ZERO_PACKET all depends on your device, and what it expects/wants, > so you don't always enable it in the flags, otherwise we would have done > so in the USB core. So it doesn't make much sense to add this to the > skeleton driver as that's not always needed by hardware. >
You are right. But the skeleton driver is a really good reference code how to make a Linux USB class driver for anyone who are not familiar with Linux USB driver codes. So, I would like to cover zero length case in the skeleton driver. But I understand what are you talking about. The skeleton driver is 'skeleton'. :) > Do you have a driver that was based on this skeleton that needed this > flag to be added to work properly? Has it been updated in the kernel > source tree properly for it? > Yes, Based on the skeleton driver, I made a bulk driver with URB_ZERO_PACKET and it works fine both my notebook(ubuntu 15.04/kernel 3.19) and my target board(Embedded Linux/kernel 2.6) With the bulk driver, I am developing USB logging daemon. > thanks, > > greg k-h Thanks jaejoong -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html