Merge pull request #1072 from uestczyh222/master

[Components][Deivers][USB][HID]fix bug and add send callback
This commit is contained in:
Bernard Xiong 2017-12-04 08:47:47 +08:00 committed by GitHub
commit f491f7cf5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -372,7 +372,10 @@ static rt_err_t _ep_in_handler(ufunction_t func, rt_size_t size)
RT_ASSERT(func->device != RT_NULL); RT_ASSERT(func->device != RT_NULL);
data = (struct hid_s *) func->user_data; data = (struct hid_s *) func->user_data;
if(data->parent.tx_complete != RT_NULL)
{
data->parent.tx_complete(&data->parent,RT_NULL);
}
return RT_EOK; return RT_EOK;
} }
@ -590,7 +593,7 @@ static void rt_usb_hid_init(struct ufunction *func)
hiddev = (struct hid_s *)func->user_data; hiddev = (struct hid_s *)func->user_data;
rt_memset(&hiddev->parent, 0, sizeof(hiddev->parent)); rt_memset(&hiddev->parent, 0, sizeof(hiddev->parent));
hiddev->parent.write = _hid_write; hiddev->parent.write = _hid_write;
hiddev->func = func;
rt_device_register(&hiddev->parent, "hidd", RT_DEVICE_FLAG_RDWR); rt_device_register(&hiddev->parent, "hidd", RT_DEVICE_FLAG_RDWR);
rt_mq_init(&hiddev->hid_mq, "hiddmq", hid_mq_pool, sizeof(struct hid_report), rt_mq_init(&hiddev->hid_mq, "hiddmq", hid_mq_pool, sizeof(struct hid_report),
sizeof(hid_mq_pool), RT_IPC_FLAG_FIFO); sizeof(hid_mq_pool), RT_IPC_FLAG_FIFO);