/* * This filter is here for the Art Pen stylus only: * - when used on some Wacom devices (see the list of attached PIDs), this pen * reports pressure every other events. * - to solve that, given that we know that the next event will be the same as * the current one, we can emulate a smoother pressure reporting by reporting * the mean of the previous value and the current one. * * We are effectively delaying the pressure by one event every other event, but * that's less of an annoyance compared to the chunkiness of the reported data. * * For example, let's assume the following set of events: * <Tip switch 0> <X 0> <Y 0> <Pressure 0 > <Tooltype 0x0804> * <Tip switch 1> <X 1> <Y 1> <Pressure 100 > <Tooltype 0x0804> * <Tip switch 1> <X 2> <Y 2> <Pressure 100 > <Tooltype 0x0804> * <Tip switch 1> <X 3> <Y 3> <Pressure 200 > <Tooltype 0x0804> * <Tip switch 1> <X 4> <Y 4> <Pressure 200 > <Tooltype 0x0804> * <Tip switch 0> <X 5> <Y 5> <Pressure 0 > <Tooltype 0x0804> * * The filter will report: * <Tip switch 0> <X 0> <Y 0> <Pressure 0 > <Tooltype 0x0804> * <Tip switch 1> <X 1> <Y 1> <Pressure * 50*> <Tooltype 0x0804> * <Tip switch 1> <X 2> <Y 2> <Pressure 100 > <Tooltype 0x0804> * <Tip switch 1> <X 3> <Y 3> <Pressure *150*> <Tooltype 0x0804> * <Tip switch 1> <X 4> <Y 4> <Pressure 200 > <Tooltype 0x0804> * <Tip switch 0> <X 5> <Y 5> <Pressure 0 > <Tooltype 0x0804> *
*/
/* * Multiple device can support the same stylus, so * we need to know which device has which offsets
*/ staticconststruct wacom_params devices[] = {
{
.pid = PID_INTUOS_PRO_2_M,
.rdesc_len = 949,
.report_id = 16,
.report_len = 27,
.offsets = {
.tip_switch = 1,
.pressure = 8,
.tool_type = 25,
},
},
};
staticstruct wacom_params params = { 0 };
/* HID-BPF reports a 64 bytes chunk anyway, so this ensures * the verifier to know we are addressing the memory correctly
*/ #define PEN_REPORT_LEN 64
/* only odd frames are modified */ staticbool odd;
SEC("syscall") int probe(struct hid_bpf_probe_args *ctx)
{ struct hid_bpf_ctx *hid_ctx;
__u16 pid; int i;
/* get a struct hid_device to access the actual pid of the device */
hid_ctx = hid_bpf_allocate_context(ctx->hid); if (!hid_ctx) {
ctx->retval = -ENODEV; return -1; /* EPERM check */
}
pid = hid_ctx->hid->product;
ctx->retval = -EINVAL;
/* Match the given device with the list of known devices */ for (i = 0; i < ARRAY_SIZE(devices); i++) { conststruct wacom_params *device = &devices[i];
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.1Bemerkung:
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.