Re: gadgetfs & endpoints

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

 



Ranran <ranshalit@xxxxxxxxx> writes:

> On Tue, Sep 4, 2018 at 10:21 PM Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote:
>>
>> On Tue, 4 Sep 2018, Ranran wrote:
>>
>> > On Tue, Sep 4, 2018 at 2:36 PM Ranran <ranshalit@xxxxxxxxx> wrote:
>> > >
>> > > Hello,
>> > >
>> > > In gadgetfs documentation I find no mention of endpoints:
>> > > https://www.kernel.org/doc/Documentation/usb/gadget_configfs.txt
>> > >
>> > > Is it possible to create endpoints using gadgetfs ?
>> > >
>> >
>> > The question need to be phrased differently:
>> > Is it possible to create HID using gadgetfs.
>>
>> Yes, it is (as far as I know -- I haven't actually tried to do it).
>>
>> > I see that it is possible to create usb device with endpoints as described here:
>> > http://www.linux-usb.org/gadget/usb.c
>> > But what about HID device ? How can we implement HID device using gadget ?
>>
>> That's a complicated question.  You can't implement an HID gadget
>> without first understanding the HID specification.  Have you read the
>> specification and do you understand it?
>>
>> Assuming you have, are there any specific questions you need answers
>> to?
>>
>
>
> I have one more question please on this topic, juto to verify:
> Seems that gadget hid (hidg) doesn't supports getfeature/setfeature ?
> https://github.com/torvalds/linux/blob/master/Documentation/usb/gadget_hid.txt
> Is it planned to be added ?

you can always send a patch implementing it. But which specific feature
are you talking about? Those are usually implemented at the UDC
level. See dwc3/ep0.c, for example:

static int dwc3_ep0_handle_feature(struct dwc3 *dwc,
		struct usb_ctrlrequest *ctrl, int set)
{
	u32			recip;
	int			ret;

	recip = ctrl->bRequestType & USB_RECIP_MASK;

	switch (recip) {
	case USB_RECIP_DEVICE:
		ret = dwc3_ep0_handle_device(dwc, ctrl, set);
		break;
	case USB_RECIP_INTERFACE:
		ret = dwc3_ep0_handle_intf(dwc, ctrl, set);
		break;
	case USB_RECIP_ENDPOINT:
		ret = dwc3_ep0_handle_endpoint(dwc, ctrl, set);
		break;
	default:
		ret = -EINVAL;
	}

	return ret;
}


-- 
balbi

Attachment: signature.asc
Description: PGP signature


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

  Powered by Linux