Lines Matching +full:data +full:- +full:size

1 // SPDX-License-Identifier: GPL-2.0
20 __u8 *rw_data = hid_bpf_get_data(hid_ctx, 0 /* offset */, 3 /* size */); in BPF_PROG()
29 return hid_ctx->size; in BPF_PROG()
40 __u8 *rw_data = hid_bpf_get_data(hid_ctx, 0 /* offset */, 3 /* size */); in __hid_subprog_first_event()
47 return hid_ctx->size; in __hid_subprog_first_event()
65 __u8 *rw_data = hid_bpf_get_data(hid_ctx, 0 /* offset */, 4 /* size */); in BPF_PROG()
72 return hid_ctx->size; in BPF_PROG()
83 __u8 *rw_data = hid_bpf_get_data(hid_ctx, 0 /* offset */, 3 /* size */); in BPF_PROG()
99 /* data needs to come at offset 0 so we can use it in calls */
100 __u8 data[10]; member
103 size_t size; member
112 const size_t size = args->size; in hid_user_raw_request() local
115 if (size > sizeof(args->data)) in hid_user_raw_request()
116 return -7; /* -E2BIG */ in hid_user_raw_request()
118 ctx = hid_bpf_allocate_context(args->hid); in hid_user_raw_request()
120 return -1; /* EPERM check */ in hid_user_raw_request()
123 args->data, in hid_user_raw_request()
124 size, in hid_user_raw_request()
125 args->type, in hid_user_raw_request()
126 args->request_type); in hid_user_raw_request()
127 args->retval = ret; in hid_user_raw_request()
138 const size_t size = args->size; in hid_user_output_report() local
141 if (size > sizeof(args->data)) in hid_user_output_report()
142 return -7; /* -E2BIG */ in hid_user_output_report()
144 ctx = hid_bpf_allocate_context(args->hid); in hid_user_output_report()
146 return -1; /* EPERM check */ in hid_user_output_report()
149 args->data, in hid_user_output_report()
150 size); in hid_user_output_report()
151 args->retval = ret; in hid_user_output_report()
162 const size_t size = args->size; in hid_user_input_report() local
165 if (size > sizeof(args->data)) in hid_user_input_report()
166 return -7; /* -E2BIG */ in hid_user_input_report()
168 ctx = hid_bpf_allocate_context(args->hid); in hid_user_input_report()
170 return -1; /* EPERM check */ in hid_user_input_report()
172 ret = hid_bpf_input_report(ctx, HID_INPUT_REPORT, args->data, size); in hid_user_input_report()
173 args->retval = ret; in hid_user_input_report()
184 0x81, 0x06, /* INPUT (Data,Var,Rel) */
193 0x91, 0x02, /* Output (Data,Var,Abs) */
205 0xb1, 0x02, /* Feature (Data,Var,Abs) */
222 __u8 *data = hid_bpf_get_data(hid_ctx, 0 /* offset */, 4096 /* size */); in BPF_PROG() local
224 if (!data) in BPF_PROG()
227 callback2_check = data[4]; in BPF_PROG()
230 __builtin_memcpy(&data[73], rdesc, sizeof(rdesc)); in BPF_PROG()
233 data[4] = 0x42; in BPF_PROG()
246 __u8 *data = hid_bpf_get_data(hid_ctx, 0 /* offset */, 4 /* size */); in BPF_PROG() local
248 if (!data) in BPF_PROG()
252 if (data[2] || data[3]) in BPF_PROG()
253 return -1; in BPF_PROG()
255 data[1] = 1; in BPF_PROG()
269 __u8 *data = hid_bpf_get_data(hid_ctx, 0 /* offset */, 4 /* size */); in BPF_PROG() local
271 if (!data) in BPF_PROG()
275 if (!data[1] || data[3]) in BPF_PROG()
276 return -1; in BPF_PROG()
278 data[2] = 2; in BPF_PROG()
291 __u8 *data = hid_bpf_get_data(hid_ctx, 0 /* offset */, 4 /* size */); in BPF_PROG() local
293 if (!data) in BPF_PROG()
297 if (!data[1] || !data[2]) in BPF_PROG()
298 return -1; in BPF_PROG()
300 data[3] = 3; in BPF_PROG()
314 return -20; in BPF_PROG()
335 __u8 *data = hid_bpf_get_data(hctx, 0 /* offset */, 3 /* size */); in BPF_PROG() local
338 if (!data) in BPF_PROG()
343 data[0] = reportnum; in BPF_PROG()
345 ret = hid_bpf_hw_request(hctx, data, 2, rtype, reqtype); in BPF_PROG()
347 return -1; in BPF_PROG()
348 data[0] = reportnum + 1; in BPF_PROG()
349 data[1] = reportnum + 2; in BPF_PROG()
350 data[2] = reportnum + 3; in BPF_PROG()
366 __u8 *data = hid_bpf_get_data(hctx, 0 /* offset */, 3 /* size */); in BPF_PROG() local
369 if (!data) in BPF_PROG()
372 /* always forward the request as-is to the device, hid-bpf should prevent in BPF_PROG()
375 data[0] = reportnum; in BPF_PROG()
377 ret = hid_bpf_hw_request(hctx, data, 2, rtype, reqtype); in BPF_PROG()
393 return -25; in BPF_PROG()
404 __u8 *data = hid_bpf_get_data(hctx, 0 /* offset */, 3 /* size */); in BPF_PROG() local
407 if (!data) in BPF_PROG()
412 return hid_bpf_hw_output_report(hctx, data, 2); in BPF_PROG()
425 __u8 *data = hid_bpf_get_data(hctx, 0 /* offset */, 3 /* size */); in BPF_PROG() local
428 if (!data) in BPF_PROG()
431 /* always forward the request as-is to the device, hid-bpf should prevent in BPF_PROG()
435 ret = hid_bpf_hw_output_report(hctx, data, 2); in BPF_PROG()
480 return -1; in test_inject_input_report_callback()
484 return -2; in test_inject_input_report_callback()
486 wq = &val->work; in test_inject_input_report_callback()
488 return -3; in test_inject_input_report_callback()
491 return -4; in test_inject_input_report_callback()
494 return -5; in test_inject_input_report_callback()
502 __u8 *data = hid_bpf_get_data(hid_ctx, 0 /* offset */, 9 /* size */); in BPF_PROG() local
503 int hid = hid_ctx->hid->id; in BPF_PROG()
506 if (!data) in BPF_PROG()
509 if (data[0] != 1) in BPF_PROG()
516 data[1] += 5; in BPF_PROG()
529 __u8 *data = hid_bpf_get_data(hid_ctx, 0 /* offset */, 9 /* size */); in BPF_PROG() local
533 if (!data) in BPF_PROG()
536 if (data[0] != 1) in BPF_PROG()
541 * will memset data to \0 in BPF_PROG()
543 __builtin_memcpy(buf, data, sizeof(buf)); in BPF_PROG()
552 * In real world we should reset the original buffer as data might be garbage now, in BPF_PROG()
555 data[1] += 5; in BPF_PROG()
569 __u8 *data = hid_bpf_get_data(hctx, 0 /* offset */, 6 /* size */); in BPF_PROG() local
572 if (!data) in BPF_PROG()
577 * will memset data to \0 in BPF_PROG()
579 __builtin_memcpy(buf, data, sizeof(buf)); in BPF_PROG()
581 /* always forward the request as-is to the device, hid-bpf should prevent in BPF_PROG()
588 /* each time we process the event, we increment by one data[1]: in BPF_PROG()
590 * has been memcopied into data by the kernel. in BPF_PROG()
592 data[1] += 1; in BPF_PROG()