Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc559a35

Browse files
Robert BaldygaFelipe Balbi
Robert Baldyga
authored and
Felipe Balbi
committed
usb: gadget: f_fs: add ioctl returning ep descriptor
This patch introduces ioctl named FUNCTIONFS_ENDPOINT_DESC, whichreturns endpoint descriptor to userspace. It works only if functionis active.Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>Acked-by: Michal Nazarewicz <mina86@mina86.com>Signed-off-by: Felipe Balbi <balbi@ti.com>
1 parente45cfa2 commitc559a35

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

‎drivers/usb/gadget/function/f_fs.c‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,6 +1026,29 @@ static long ffs_epfile_ioctl(struct file *file, unsigned code,
10261026
caseFUNCTIONFS_ENDPOINT_REVMAP:
10271027
ret=epfile->ep->num;
10281028
break;
1029+
caseFUNCTIONFS_ENDPOINT_DESC:
1030+
{
1031+
intdesc_idx;
1032+
structusb_endpoint_descriptor*desc;
1033+
1034+
switch (epfile->ffs->gadget->speed) {
1035+
caseUSB_SPEED_SUPER:
1036+
desc_idx=2;
1037+
break;
1038+
caseUSB_SPEED_HIGH:
1039+
desc_idx=1;
1040+
break;
1041+
default:
1042+
desc_idx=0;
1043+
}
1044+
desc=epfile->ep->descs[desc_idx];
1045+
1046+
spin_unlock_irq(&epfile->ffs->eps_lock);
1047+
ret=copy_to_user((void*)value,desc,sizeof(*desc));
1048+
if (ret)
1049+
ret=-EFAULT;
1050+
returnret;
1051+
}
10291052
default:
10301053
ret=-ENOTTY;
10311054
}

‎include/uapi/linux/usb/functionfs.h‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,12 @@ struct usb_functionfs_event {
275275
*/
276276
#defineFUNCTIONFS_ENDPOINT_REVMAP_IO('g', 129)
277277

278+
/*
279+
* Returns endpoint descriptor. If function is not active returns -ENODEV.
280+
*/
281+
#defineFUNCTIONFS_ENDPOINT_DESC_IOR('g', 130, \
282+
struct usb_endpoint_descriptor)
283+
278284

279285

280286
#endif/* _UAPI__LINUX_FUNCTIONFS_H__ */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp