Hi,
I'm trying to write a Hid driver for MCP2210. But the USB Hid
specification is quite complicated.
I would like to know how to send and receive data to the device. Any
links to a good tutorial ?
This is my current driver is attached.
Thanks
Lucas
#define DEBUG
#include <linux/module.h>
#include <linux/hid.h>
#include <linux/usb.h>
static int mcp2210_probe(struct hid_device *hdev,
const struct hid_device_id *id)
{
struct usb_interface *intf = to_usb_interface(hdev->dev.parent);
int ret = 0;
hid_dbg(hdev, "%s\n", __FUNCTION__);
ret = hid_parse(hdev);
if (ret) {
hid_err(hdev, "parse failed\n");
return ret;
} else {
hid_dbg(hdev, "parse success\n");
}
ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
if (ret) {
hid_err(hdev, "hw start failed\n");
return ret;
} else {
hid_dbg(hdev, "start success\n");
}
return 0;
}
static const struct hid_device_id mcp2210_table[] = {
{ HID_USB_DEVICE(0x04d8, 0x00de) },
{}
};
MODULE_DEVICE_TABLE(hid, mcp2210_table);
static struct hid_driver mcp2210_driver = {
.name = "MCP2210 USB SPI Driver",
.probe = mcp2210_probe,
.id_table = mcp2210_table,
};
module_hid_driver(mcp2210_driver);
MODULE_AUTHOR("Lucas Tanure <[email protected]>");
MODULE_DESCRIPTION("Core driver for MCP2210 USB SPI adapter");
MODULE_LICENSE("GPL v2");
_______________________________________________
Kernelnewbies mailing list
[email protected]
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies