Skip to content

Commit

Permalink
Move the bluetooth initialization code on correct place
Browse files Browse the repository at this point in the history
  • Loading branch information
Wolf3s committed Dec 5, 2024
1 parent 3c09905 commit 4c64424
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 16 deletions.
14 changes: 6 additions & 8 deletions modules/pademu/ds3bt.c
Original file line number Diff line number Diff line change
Expand Up @@ -323,18 +323,10 @@ static int HCI_Command(int nbytes, u8 *dataptr)

static int hci_reset()
{
int pad = 0;
hci_cmd_buf[0] = HCI_OCF_RESET;
hci_cmd_buf[1] = HCI_OGF_CTRL_BBAND;
hci_cmd_buf[2] = 0x00; // Parameter Total Length = 0

padf[pad].priv = &ds3pad[pad];
padf[pad].get_status = ds3bt_get_status;
padf[pad].get_model = ds3bt_get_model;
padf[pad].get_data = ds3bt_get_data;
padf[pad].set_rumble = ds3bt_set_rumble;
padf[pad].set_mode = ds3bt_set_mode;

return HCI_Command(3, hci_cmd_buf);
}

Expand Down Expand Up @@ -679,6 +671,12 @@ static void ds3pad_clear(int pad)
ds3pad[pad].data[1] = 0xFF;
mips_memset(&ds3pad[pad].data[2], 0x7F, 4);
mips_memset(&ds3pad[pad].data[6], 0x00, 12);
padf[pad].priv = &ds3pad[pad];
padf[pad].get_status = ds3bt_get_status;
padf[pad].get_model = ds3bt_get_model;
padf[pad].get_data = ds3bt_get_data;
padf[pad].set_rumble = ds3bt_set_rumble;
padf[pad].set_mode = ds3bt_set_mode;
}

static void ds3pad_init()
Expand Down
14 changes: 6 additions & 8 deletions modules/pademu/ds4bt.c
Original file line number Diff line number Diff line change
Expand Up @@ -321,18 +321,10 @@ static int HCI_Command(int nbytes, u8 *dataptr)

static int hci_reset()
{
int pad = 0;
hci_cmd_buf[0] = HCI_OCF_RESET;
hci_cmd_buf[1] = HCI_OGF_CTRL_BBAND;
hci_cmd_buf[2] = 0x00; // Parameter Total Length = 0

padf[pad].priv = &ds4pad[pad];
padf[pad].get_status = ds4bt_get_status;
padf[pad].get_model = ds4bt_get_model;
padf[pad].get_data = ds4bt_get_data;
padf[pad].set_rumble = ds4bt_set_rumble;
padf[pad].set_mode = ds4bt_set_mode;

return HCI_Command(3, hci_cmd_buf);
}

Expand Down Expand Up @@ -678,6 +670,12 @@ static void ds4pad_clear(int pad)
ds4pad[pad].btn_delay = 0;
ds4pad[pad].data[0] = 0xFF;
ds4pad[pad].data[1] = 0xFF;
padf[pad].priv = &ds4pad[pad];
padf[pad].get_status = ds4bt_get_status;
padf[pad].get_model = ds4bt_get_model;
padf[pad].get_data = ds4bt_get_data;
padf[pad].set_rumble = ds4bt_set_rumble;
padf[pad].set_mode = ds4bt_set_mode;
mips_memset(&ds4pad[pad].data[2], 0x7F, 4);
mips_memset(&ds4pad[pad].data[6], 0x00, 12);
}
Expand Down

0 comments on commit 4c64424

Please sign in to comment.