Begin add usb driver
This commit is contained in:
parent
311e9be037
commit
fc3991c0cc
4 changed files with 96 additions and 0 deletions
53
10_lnp_usb_driver/test_module.c
Normal file
53
10_lnp_usb_driver/test_module.c
Normal file
|
@ -0,0 +1,53 @@
|
|||
#include <linux/init.h>
|
||||
#include <linux/usb.h>
|
||||
#include <linux/module.h>
|
||||
|
||||
#define USB_VENDOR_ID_CORSAIR 0x1b1c
|
||||
#define USB_DEVICE_ID_LIGHTNING_NODE_PRO 0x0c0b
|
||||
|
||||
static int lnp_driver_probe(struct usb_interface *interface,
|
||||
const struct usb_device_id *id)
|
||||
{
|
||||
pr_info("Détection USB pour Lightning Node Pro\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct usb_device_id lnp_driver_table[] = {
|
||||
{ USB_DEVICE(USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_LIGHTNING_NODE_PRO) },
|
||||
{} /* Entrée de terminaison */
|
||||
};
|
||||
MODULE_DEVICE_TABLE(usb, lnp_driver_table);
|
||||
|
||||
static struct usb_driver lnp_driver = {
|
||||
.name = "lightning-node-pro",
|
||||
.id_table = lnp_driver_table,
|
||||
.probe = lnp_driver_probe,
|
||||
};
|
||||
|
||||
static int __init lnp_usb_driver_init(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = usb_register(&lnp_driver);
|
||||
if (ret < 0) {
|
||||
pr_err("lnp_usb_driver: Impossible d'enregistrer le pilote pour %s. Code d'erreur: %d\n",
|
||||
lnp_driver.name, ret);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void __exit lnp_usb_driver_exit(void)
|
||||
{
|
||||
usb_deregister(&lnp_driver);
|
||||
}
|
||||
|
||||
module_init(lnp_usb_driver_init);
|
||||
module_exit(lnp_usb_driver_exit);
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_AUTHOR("Florian RICHER <florian.richer@protonmail.com>");
|
||||
MODULE_DESCRIPTION("Un module noyau pour utiliser le Lightning Node Pro LED");
|
||||
MODULE_VERSION("1.0");
|
Loading…
Add table
Add a link
Reference in a new issue