add callback for report_descriptor#302
Merged
Merged
Conversation
lneto
reviewed
Jul 11, 2025
lneto
reviewed
Jul 11, 2025
lneto
reviewed
Jul 11, 2025
lneto
reviewed
Jul 11, 2025
lneto
reviewed
Jul 11, 2025
lneto
reviewed
Jul 11, 2025
lneto
reviewed
Jul 11, 2025
lneto
reviewed
Jul 15, 2025
lneto
reviewed
Jul 15, 2025
lneto
reviewed
Jul 15, 2025
lneto
reviewed
Jul 15, 2025
lneto
reviewed
Jul 15, 2025
lneto
reviewed
Jul 15, 2025
lneto
reviewed
Jul 15, 2025
lneto
reviewed
Jul 15, 2025
c5ecc77 to
8e22abb
Compare
lneto
reviewed
Jul 18, 2025
lneto
reviewed
Jul 18, 2025
lneto
reviewed
Jul 18, 2025
lneto
reviewed
Jul 18, 2025
lneto
reviewed
Jul 18, 2025
lneto
reviewed
Jul 19, 2025
lneto
reviewed
Jul 19, 2025
lneto
reviewed
Jul 28, 2025
lneto
reviewed
Jul 28, 2025
lneto
reviewed
Jul 28, 2025
lneto
reviewed
Aug 1, 2025
a02caeb to
6ee9fad
Compare
lneto
reviewed
Aug 5, 2025
lneto
reviewed
Aug 6, 2025
lneto
reviewed
Aug 6, 2025
lneto
reviewed
Aug 6, 2025
lneto
reviewed
Aug 6, 2025
lneto
reviewed
Aug 6, 2025
lneto
reviewed
Aug 6, 2025
lneto
reviewed
Aug 6, 2025
lneto
reviewed
Aug 6, 2025
lneto
reviewed
Aug 6, 2025
lneto
reviewed
Aug 6, 2025
lneto
reviewed
Aug 6, 2025
lneto
reviewed
Aug 7, 2025
lneto
reviewed
Aug 7, 2025
Comment on lines
+106
to
+124
| #define luahid_pcall(L, func, arg) \ | ||
| do { \ | ||
| int n = lua_gettop(L); \ | ||
| lua_pushcfunction(L, func); \ | ||
| lua_pushlightuserdata(L, (void *)arg); \ | ||
| if (lua_pcall(L, 1, LUA_MULTRET, 0) != LUA_OK) { \ | ||
| pr_warn("%s: %s\n", #func, lua_tostring(L, -1)); \ | ||
| lua_settop(L, n); \ | ||
| } \ | ||
| } while (0) | ||
|
|
||
| #define luahid_newtable(L, dev, extra) \ | ||
| do { \ | ||
| lua_newtable(L); \ | ||
| luahid_setfield(L, -1, dev, bus); \ | ||
| luahid_setfield(L, -1, dev, group); \ | ||
| luahid_setfield(L, -1, dev, vendor); \ | ||
| luahid_setfield(L, -1, dev, product); \ | ||
| luahid_setfield(L, -1, dev, extra); \ |
lneto
reviewed
Aug 7, 2025
| { | ||
| if (luahid_checkdriver(L, hid, -1, "_info") || lua_getfield(L, -2, "report_fixup") != LUA_TFUNCTION) { | ||
| pr_warn("report_fixup: invaild driver\n"); | ||
| return 0; |
Contributor
There was a problem hiding this comment.
Suggested change
| return 0; | |
| goto out; |
lneto
reviewed
Aug 7, 2025
| lunatik_object_t *data; | ||
| if ((data = luahid_getdescriptor(L, hid)) == NULL) { | ||
| pr_warn("report_fixup: descriptor not found\n"); | ||
| return 0; |
Contributor
There was a problem hiding this comment.
Suggested change
| return 0; | |
| goto out; |
lneto
reviewed
Aug 7, 2025
| pr_warn("report_fixup: %s\n", lua_tostring(L, -1)); | ||
|
|
||
| luadata_clear(data); | ||
| return 0; |
Contributor
There was a problem hiding this comment.
Suggested change
| return 0; | |
| out: | |
| return 0; /* unused */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces enhancements to the HID driver integration in the
lib/luahid.cfile, including the addition of support for report fixups, a newluadata_tstructure, and improved Lua integration for HID device information. These changes aim to extend the functionality of the driver and improve its interaction with Lua scripts.New functionality for report fixups:
luahid_report_fixupfunction to handle report fixups for HID devices, with support for kernel versions 6.12.0 and above. This function integrates Lua-based processing of HID reports, allowing modifications to the report data.luahid_doreport_fixuphelper function to manage the Lua interaction for report fixups, including creating and handlingluadata_tobjects for report data.New data structure and Lua integration:
luadata_tstructure to encapsulate report data, including a pointer to the data, its size, and additional options.luahid_push_device_infofunction to populate a Lua table with detailed HID device information, such as vendor, product, and version.Registration enhancements:
luahid_registerfunction to initialize a_report_destable for storing report descriptors and to assign the newreport_fixupcallback to the HID driver.These changes improve the modularity and extensibility of the HID driver, enabling advanced use cases through Lua scripting.