qn1547021883

qn1547021883

0个粉丝

10

问答

0

专栏

0

资料

qn1547021883  发布于  2020-03-12 13:59:25
采纳率 0%
10个问答
652

usb gadget hid,模拟鼠标

     
本帖最后由 qn1547021883 于 2020-3-12 14:46 编辑

已把usb相关全部配成模块,手动insmod。

[code]insmod dwc3.ko
insmod libcomposite.ko
insmod u_ether.ko
insmod u_serial.ko
insmod usb_f_acm.ko
insmod usb_f_rndis.ko
insmod g_multi.ko
insmod g_hid.ko
[/code]
这样一顿操作的话,最后安装g_hid.ko时提示:udc-core: couldn't find an available UDC - added [g_hid] to list of pending drivers,并且/dev/hidg设备文件也没生成。但是find / -name hid* 一看,设备层 驱动层都注册没问题。
[code]/app/komod # find / -name hid*
/bin/hiddrs
/sys/devices/platform/hidg.0
/sys/firmware/devicetree/base/soc/hidwc3_0@0x100e0000
/sys/firmware/devicetree/base/soc/hidma-controller@10060000
/sys/bus/platform/devices/hidg.0
/sys/bus/platform/drivers/hidg
/sys/bus/platform/drivers/hidg/hidg.0[/code]



[code]insmod dwc3.ko
insmod libcomposite.ko
insmod usb_f_hid.ko
insmod g_hid.ko
[/code]
这样一顿操作的话,最后安装g_hid.ko时,虚拟地址操作指针错误,内核奔溃。/dev/hidg同样不存在。

参考的文档是《外围设备驱动 操作指南》,usb章节中device部分 只介绍了U盘和网卡,并没涉及hid。。

希望有经验的大佬指点一下,不胜感激。
我来回答
回答12个
时间排序
认可量排序

ak491980

0个粉丝

34

问答

0

专栏

8

资料

ak491980 2020-03-12 20:22:29
认可0
自己作为usb device 模拟 鼠标?

qn1547021883

0个粉丝

10

问答

0

专栏

0

资料

qn1547021883 2020-03-13 15:23:43
认可0
[quote][url=forum.php?mod=redirect&goto=findpost&pid=155430&ptid=79437]ak491980 发表于 2020-3-12 20:22[/url]
自己作为usb device 模拟 鼠标?[/quote]

海思板子通过usb线接电脑,可以当鼠标控制电脑。

it_0918

0个粉丝

18

问答

0

专栏

0

资料

it_0918 2020-03-14 14:08:22
认可0
[quote][url=forum.php?mod=redirect&goto=findpost&pid=155456&ptid=79437]qn1547021883 发表于 2020-3-13 15:23[/url]
海思板子通过usb线接电脑,可以当鼠标控制电脑。[/quote]

求教下有没有在hi3559av100 下,使用过usb2.0接口,该如何配置??

charles1971

0个粉丝

1

问答

0

专栏

0

资料

charles1971 2020-04-16 20:49:06
认可0
我用3516ev200 遇到一樣的問題 樓主有研究出來了吧?

charles1971

0个粉丝

1

问答

0

专栏

0

资料

charles1971 2020-04-16 22:42:15
认可0
我google到解法了 百度真的沒毛用 不能翻牆的話 做嵌入式Linux必死

qn1547021883

0个粉丝

10

问答

0

专栏

0

资料

qn1547021883 2020-04-23 15:48:02
认可0
[quote][url=forum.php?mod=redirect&goto=findpost&pid=156860&ptid=79437]charles1971 发表于 2020-4-16 22:42[/url]
我google到解法了 百度真的沒毛用 不能翻牆的話 做嵌入式Linux必死[/quote]

最后发现是3559v200不支持usb的中断传输。您解决了吗

lxjdabao

0个粉丝

0

问答

0

专栏

0

资料

lxjdabao 2020-05-03 10:04:14
认可0
[quote][url=forum.php?mod=redirect&goto=findpost&pid=156860&ptid=79437]charles1971 发表于 2020-4-16 22:42[/url]
我google到解法了 百度真的沒毛用 不能翻牆的話 做嵌入式Linux必死[/quote]

能告诉我怎么解决的吗?功我也遇到同样的问题,google用不了

what6300

0个粉丝

1

问答

0

专栏

0

资料

what6300 2020-05-07 15:22:38
认可0
我也在弄,有配成功的吗?大神能分享一下思路吗?

what6300

0个粉丝

1

问答

0

专栏

0

资料

what6300 2020-05-21 17:34:26
认可0
兄弟,问题解决了吗?能分享一下思路吗?

qn1547021883

0个粉丝

10

问答

0

专栏

0

资料

qn1547021883 2020-05-22 16:50:28
认可0
[quote][url=forum.php?mod=redirect&goto=findpost&pid=158822&ptid=79437]what6300 发表于 2020-5-21 17:34[/url]
兄弟,问题解决了吗?能分享一下思路吗?[/quote]

没解决,发现是3559不支持usb中断传输,可能要接单片机。已跳槽,现在不研究这问题了

qn1535876279

0个粉丝

0

问答

0

专栏

0

资料

qn1535876279 2020-07-15 16:33:11
认可0
[quote][url=forum.php?mod=redirect&goto=findpost&pid=158882&ptid=79437]qn1547021883 发表于 2020-5-22 16:50[/url]
没解决,发现是3559不支持usb中断传输,可能要接单片机。已跳槽,现在不研究这问题了[/quote]

解决了,是驱动有Bug。

[code]diff --git a/drivers/usb/gadget/function/f_hid.c b/drivers/usb/gadget/function/f_hid.c
index b0f71957..ef173dbe 100644
--- a/drivers/usb/gadget/function/f_hid.c
+++ b/drivers/usb/gadget/function/f_hid.c
@@ -660,10 +660,14 @@ static int hidg_bind(struct usb_configuration *c, struct usb_function *f)

        /* preallocate request and buffer */
        status = -ENOMEM;
-       hidg->req = alloc_ep_req(hidg->in_ep, hidg->report_length);
+       hidg->req = usb_ep_alloc_request(hidg->in_ep, GFP_KERNEL);
        if (!hidg->req)
                goto fail;

+       hidg->req->buf = kmalloc(hidg->report_length, GFP_KERNEL);
+       if (!hidg->req->buf)
+               goto fail;
+
        /* set descriptor dynamic values */
        hidg_interface_desc.bInterfaceSubClass = hidg->bInterfaceSubClass;
        hidg_interface_desc.bInterfaceProtocol = hidg->bInterfaceProtocol;[/code]


原始参考链接:https://lore.kernel.org/patchwork/patch/746915/

what6300

0个粉丝

1

问答

0

专栏

0

资料

what6300 2020-07-22 15:58:55
认可0
[quote][url=forum.php?mod=redirect&goto=findpost&pid=160774&ptid=79437]qn1535876279 发表于 2020-7-15 16:33[/url]
解决了,是驱动有Bug。


[/quote]

确实是驱动的bug。:handshake
或将文件直接拖到这里
悬赏:
E币
网盘
* 网盘链接:
* 提取码:
悬赏:
E币

Markdown 语法

  • 加粗**内容**
  • 斜体*内容*
  • 删除线~~内容~~
  • 引用> 引用内容
  • 代码`代码`
  • 代码块```编程语言↵代码```
  • 链接[链接标题](url)
  • 无序列表- 内容
  • 有序列表1. 内容
  • 缩进内容
  • 图片![alt](url)
+ 添加网盘链接/附件

Markdown 语法

  • 加粗**内容**
  • 斜体*内容*
  • 删除线~~内容~~
  • 引用> 引用内容
  • 代码`代码`
  • 代码块```编程语言↵代码```
  • 链接[链接标题](url)
  • 无序列表- 内容
  • 有序列表1. 内容
  • 缩进内容
  • 图片![alt](url)
举报反馈

举报类型

  • 内容涉黄/赌/毒
  • 内容侵权/抄袭
  • 政治相关
  • 涉嫌广告
  • 侮辱谩骂
  • 其他

详细说明

易百纳技术社区