| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /* | ||
| 2 | * Copyright (c) 2021-2025, Jacques Gagnon | ||
| 3 | * SPDX-License-Identifier: Apache-2.0 | ||
| 4 | */ | ||
| 5 | |||
| 6 | #include <stddef.h> | ||
| 7 | #include "hid_generic.h" | ||
| 8 | #include "ps3.h" | ||
| 9 | #include "wii.h" | ||
| 10 | #include "ps.h" | ||
| 11 | #include "sw.h" | ||
| 12 | #include "sw2.h" | ||
| 13 | #include "wireless.h" | ||
| 14 | |||
| 15 | static to_generic_t to_generic_func[BT_TYPE_MAX] = { | ||
| 16 | hid_to_generic, /* BT_HID_GENERIC */ | ||
| 17 | ps3_to_generic, /* BT_PS3 */ | ||
| 18 | wii_to_generic, /* BT_WII */ | ||
| 19 | ps_to_generic, /* BT_PS */ | ||
| 20 | sw_to_generic, /* BT_SW */ | ||
| 21 | sw2_to_generic, /* BT_SW2 */ | ||
| 22 | }; | ||
| 23 | |||
| 24 | static fb_from_generic_t fb_from_generic_func[BT_TYPE_MAX] = { | ||
| 25 | hid_fb_from_generic, /* BT_HID_GENERIC */ | ||
| 26 | ps3_fb_from_generic, /* BT_PS3 */ | ||
| 27 | wii_fb_from_generic, /* BT_WII */ | ||
| 28 | ps_fb_from_generic, /* BT_PS */ | ||
| 29 | sw_fb_from_generic, /* BT_SW */ | ||
| 30 | sw2_fb_from_generic, /* BT_SW2 */ | ||
| 31 | }; | ||
| 32 | |||
| 33 | 1330 | int32_t wireless_to_generic(struct bt_data *bt_data, struct wireless_ctrl *ctrl_data) { | |
| 34 | 1330 | int32_t ret = -1; | |
| 35 | |||
| 36 |
1/2✓ Branch 0 (2→3) taken 1330 times.
✗ Branch 1 (2→4) not taken.
|
1330 | if (to_generic_func[bt_data->base.pids->type]) { |
| 37 | 1330 | ret = to_generic_func[bt_data->base.pids->type](bt_data, ctrl_data); | |
| 38 | } | ||
| 39 | |||
| 40 | 1330 | return ret; | |
| 41 | } | ||
| 42 | |||
| 43 | 27 | bool wireless_fb_from_generic(struct generic_fb *fb_data, struct bt_data *bt_data) { | |
| 44 | 27 | bool ret = false; | |
| 45 | |||
| 46 |
1/2✓ Branch 0 (2→3) taken 27 times.
✗ Branch 1 (2→4) not taken.
|
27 | if (fb_from_generic_func[bt_data->base.pids->type]) { |
| 47 | 27 | ret = fb_from_generic_func[bt_data->base.pids->type](fb_data, bt_data); | |
| 48 | } | ||
| 49 | |||
| 50 | 27 | return ret; | |
| 51 | } | ||
| 52 | |||
| 53 |