diff --git a/10_lightning_node_pro_led/lightning_node_pro_led.c b/10_lightning_node_pro_led/lightning_node_pro_led.c index 2f9ba8f..5b30171 100644 --- a/10_lightning_node_pro_led/lightning_node_pro_led.c +++ b/10_lightning_node_pro_led/lightning_node_pro_led.c @@ -5,17 +5,54 @@ #define USB_VENDOR_ID_CORSAIR 0x1b1c #define USB_DEVICE_ID_LIGHTNING_NODE_PRO 0x0c0b +#define NUMBER_OF_ZONES_PER_LL120_FAN 16 +#define LIGHTNODE_PRO_MAX_FAN 6 + +#define MSG_SIZE 64 + +#define RED_COLOR 0x00 +#define BLUE_COLOR 0x01 +#define GREEN_COLOR 0x02 + +static short int number_of_fan = 1; +module_param(number_of_fan, short, 0000); +MODULE_PARM_DESC(number_of_fan, + "Number of LL120 FAN connected to the lightning node pro"); + +struct lightning_node_pro_led_data { + struct hid_device *hdev; + struct mutex lock; +}; + static int lightning_node_pro_led_probe(struct hid_device *hdev, const struct hid_device_id *id) { pr_info("Détection USB pour Lightning Node Pro\n"); + int ret; + struct lightning_node_pro_led_data *data; + + data = kzalloc(sizeof(*data), GFP_KERNEL); + if (!data) + return -ENOMEM; + + data->hdev = hdev; + mutex_init(&data->lock); + hid_set_drvdata(hdev, data); + return 0; + +free_ldata: + kfree(data); + + return ret; } -static void lightning_node_pro_led_remove(struct hid_device *dev) +static void lightning_node_pro_led_remove(struct hid_device *hdev) { + struct lightning_node_pro_led_data *data = hid_get_drvdata(hdev); pr_info("Retrait USB pour Lightning Node Pro\n"); + kfree(data); } static struct hid_device_id lightning_node_pro_led_table[] = {