-
Notifications
You must be signed in to change notification settings - Fork 45
Integrate LuaHID GSoC 2025 #337
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
examples/xiaomi.lua
Outdated
| @@ -0,0 +1,75 @@ | |||
| -- | |||
| -- SPDX-FileCopyrightText: (c) 2024 Mohammad Shehar Yaar Tausif <sheharyaar48@gmail.com> | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@qrsikno2 we should have your copyright here
| -- all = false -- This is the default | ||
| -- For more LDoc options, see: https://github.com/lunarmodules/LDoc | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revert
| #define lunatik_runbh(runtime, handler, ret, ...) \ | ||
| do { \ | ||
| local_bh_disable(); \ | ||
| lunatik_lock(runtime); \ | ||
| if (unlikely(!lunatik_getstate(runtime))) \ | ||
| ret = -ENXIO; \ | ||
| else \ | ||
| lunatik_handle(runtime, handler, ret, ## __VA_ARGS__); \ | ||
| lunatik_unlock(runtime); \ | ||
| local_bh_enable(); \ | ||
| } while(0) | ||
|
|
||
| #define lunatik_runirq(runtime, handler, ret, ...) \ | ||
| do { \ | ||
| unsigned long flags; \ | ||
| local_irq_save(flags); \ | ||
| lunatik_lock(runtime); \ | ||
| if (unlikely(!lunatik_getstate(runtime))) \ | ||
| ret = -ENXIO; \ | ||
| else \ | ||
| lunatik_handle(runtime, handler, ret, ## __VA_ARGS__); \ | ||
| lunatik_unlock(runtime); \ | ||
| local_irq_restore(flags); \ | ||
| } while(0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unused
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find the lunatik_runirq is called in this line.
But the lunatik_runbh doesn't appear..do i need to remove it or both?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see two options.. keep them but calling lunatik_run inside, e.g.,
| #define lunatik_runbh(runtime, handler, ret, ...) \ | |
| do { \ | |
| local_bh_disable(); \ | |
| lunatik_lock(runtime); \ | |
| if (unlikely(!lunatik_getstate(runtime))) \ | |
| ret = -ENXIO; \ | |
| else \ | |
| lunatik_handle(runtime, handler, ret, ## __VA_ARGS__); \ | |
| lunatik_unlock(runtime); \ | |
| local_bh_enable(); \ | |
| } while(0) | |
| #define lunatik_runirq(runtime, handler, ret, ...) \ | |
| do { \ | |
| unsigned long flags; \ | |
| local_irq_save(flags); \ | |
| lunatik_lock(runtime); \ | |
| if (unlikely(!lunatik_getstate(runtime))) \ | |
| ret = -ENXIO; \ | |
| else \ | |
| lunatik_handle(runtime, handler, ret, ## __VA_ARGS__); \ | |
| lunatik_unlock(runtime); \ | |
| local_irq_restore(flags); \ | |
| } while(0) | |
| #define lunatik_runbh(runtime, handler, ret, ...) \ | |
| do { \ | |
| local_bh_disable(); \ | |
| lunatik_run(runtime, handler, ret, ## __VA_ARGS__); \ | |
| local_bh_enable(); \ | |
| } while(0) | |
| #define lunatik_runirq(runtime, handler, ret, ...) \ | |
| do { \ | |
| unsigned long flags; \ | |
| local_irq_save(flags); \ | |
| lunatik_run(runtime, handler, ret, ## __VA_ARGS__); \ | |
| local_irq_restore(flags); \ | |
| } while(0) |
and applying to the other modules as luanetfilter and luaxdp, or removing them completely and calling local_bh_disable and local_irq_save explicitly..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think will split this in a separate commit..
lib/luahid.c
Outdated
| typedef struct { | ||
| const struct hid_device_id *id; | ||
| } luahid_probe_arg_t; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need such structure?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's because we need a fixed type pattern of defination like luahid_xxx_arg_t for marco LUAHID_CALLBACK in this line. It needs to be defined for each callback.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so, we can just use a typedef, we don't need a nested struct.. I made the change.. can you check if it's working properly?
lib/luahid.c
Outdated
| #include <lunatik.h> | ||
| #include <lauxlib.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| #include <lunatik.h> | |
| #include <lauxlib.h> | |
| #include <lunatik.h> |
* port hid-xiaomi to examples * add gesture detection for qemu mouse
| -- Drvier for Qemu's USB mouse with gesture(dragging), | ||
| -- swipeing up to lock the mouse and swipeing down to unlock it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should add an entry on README for both examples, explaining how to run them
https://github.com/qrsikno2/GSoC2025