11/*
2- * SPDX-FileCopyrightText: (c) 2024 Jieming Zhou <[email protected] > 2+ * SPDX-FileCopyrightText: (c) 2025 Jieming Zhou <[email protected] > 33* SPDX-License-Identifier: MIT OR GPL-2.0-only
44*/
55
@@ -24,7 +24,10 @@ typedef struct luahid_s {
2424 struct hid_driver driver ;
2525} luahid_t ;
2626
27- //kernel codes
27+ /*
28+ * kernel codes copied from drivers/hid/hid-generic.c
29+ * links: https://elixir.bootlin.com/linux/v6.13.7/source/drivers/hid/hid-generic.c
30+ */
2831static int hid_generic_probe (struct hid_device * hdev ,
2932 const struct hid_device_id * id )
3033{
@@ -75,12 +78,14 @@ static const lunatik_class_t luahid_class = {
7578
7679static int luahid_register (lua_State * L )
7780{
78- luaL_checktype (L , 1 , LUA_TTABLE ); // assure that is a driver
81+ luaL_checktype (L , 1 , LUA_TTABLE ); /* assure that is a driver */
7982
8083 lunatik_object_t * object = lunatik_newobject (L , & luahid_class , sizeof (luahid_t ));
8184 luahid_t * hid = (luahid_t * )object -> private ;
8285
83- //configure the driver's properties & callbacks
86+ /*
87+ * configure the driver's properties & callbacks
88+ */
8489 struct hid_driver * user_driver = & (hid -> driver );
8590 user_driver -> name = lunatik_checkalloc (L , NAME_MAX );
8691 lunatik_setstring (L , 1 , user_driver , name , NAME_MAX );
@@ -96,7 +101,6 @@ static int luahid_register(lua_State *L)
96101 }
97102 lunatik_setruntime (L , hid , hid );
98103 lunatik_getobject (hid -> runtime );
99- // pass
100104 return 1 ; /* object */
101105}
102106
0 commit comments