Android bt hid(bluedroid)和linux HID-subsystem

来源:互联网 发布:阿里云的视频点播服务 编辑:程序博客网 时间:2024/06/05 20:32


Android采用bluedroid后,stack运行在用户空间,那bthid如何与linux HID-subsystem联系呢?

答案就是UHID


UHID - User-space I/O driver support forHID subsystem

详情参考:

\kernel\Documentation\hid\uhid.txt

 

Bluedroid

\android\external\bluetooth\bluedroid\btif\co\bta_hh_co.c

 

Open uhid

const char *dev_path ="/dev/uhid";

p_dev->fd = open(dev_path, O_RDWR |O_CLOEXEC);

 

create hid dev

   ev.type = UHID_CREATE;

    result =uhid_write(p_dev->fd, &ev);

 

hid_report

   ev.type = UHID_INPUT;

    returnuhid_write(fd, &ev);

 

destroy hid dev

    ev.type = UHID_DESTROY;

   uhid_write(fd, &ev);

 

close uhid

    close(fd);
原创粉丝点击