mirror of
https://github.com/libretro/RetroArch
synced 2025-02-22 21:40:40 +00:00
(iOS, BTstack) Cleanup l2cap commands
This commit is contained in:
parent
c5d95dbbf7
commit
947a838a7b
@ -116,8 +116,8 @@ void btpad_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet
|
|||||||
btpad_queue_reset();
|
btpad_queue_reset();
|
||||||
|
|
||||||
btpad_queue_hci_read_bd_addr();
|
btpad_queue_hci_read_bd_addr();
|
||||||
btpad_queue_l2cap_register_service(PSM_HID_CONTROL, 672); // TODO: Where did I get 672 for mtu?
|
bt_send_cmd_ptr(l2cap_register_service_ptr, PSM_HID_CONTROL, 672); // TODO: Where did I get 672 for mtu?
|
||||||
btpad_queue_l2cap_register_service(PSM_HID_INTERRUPT, 672);
|
bt_send_cmd_ptr(l2cap_register_service_ptr, PSM_HID_INTERRUPT, 672);
|
||||||
btpad_queue_hci_inquiry(HCI_INQUIRY_LAP, 3, 1);
|
btpad_queue_hci_inquiry(HCI_INQUIRY_LAP, 3, 1);
|
||||||
|
|
||||||
btpad_queue_run(1);
|
btpad_queue_run(1);
|
||||||
@ -180,8 +180,8 @@ void btpad_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet
|
|||||||
btpad_connection[slot].state = BTPAD_CONNECTING;
|
btpad_connection[slot].state = BTPAD_CONNECTING;
|
||||||
btpad_connection[slot].slot = slot;
|
btpad_connection[slot].slot = slot;
|
||||||
|
|
||||||
btpad_queue_l2cap_create_channel(btpad_connection[slot].address, PSM_HID_CONTROL);
|
bt_send_cmd_ptr(l2cap_create_channel_ptr, btpad_connection[slot].address, PSM_HID_CONTROL);
|
||||||
btpad_queue_l2cap_create_channel(btpad_connection[slot].address, PSM_HID_INTERRUPT);
|
bt_send_cmd_ptr(l2cap_create_channel_ptr, btpad_connection[slot].address, PSM_HID_INTERRUPT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -259,7 +259,7 @@ void btpad_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet
|
|||||||
}
|
}
|
||||||
|
|
||||||
ios_add_log_message("BTpad: Incoming L2CAP connection (Slot: %d, PSM: %02X)", slot, psm);
|
ios_add_log_message("BTpad: Incoming L2CAP connection (Slot: %d, PSM: %02X)", slot, psm);
|
||||||
btpad_queue_l2cap_accept_connection(channel_id);
|
bt_send_cmd_ptr(l2cap_accept_connection_ptr, channel_id);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -17,9 +17,6 @@
|
|||||||
#include "btpad.h"
|
#include "btpad.h"
|
||||||
#include "btpad_queue.h"
|
#include "btpad_queue.h"
|
||||||
|
|
||||||
// NOTE: It seems that it is not needed to wait for the l2cap commands; TODO: Confirm
|
|
||||||
// #define WAIT_FOR_L2CAP
|
|
||||||
|
|
||||||
struct btpad_queue_command
|
struct btpad_queue_command
|
||||||
{
|
{
|
||||||
const hci_cmd_t* command;
|
const hci_cmd_t* command;
|
||||||
@ -57,31 +54,6 @@ struct btpad_queue_command
|
|||||||
bd_addr_t bd_addr;
|
bd_addr_t bd_addr;
|
||||||
bd_addr_t pin;
|
bd_addr_t pin;
|
||||||
} hci_pin_code_request_reply;
|
} hci_pin_code_request_reply;
|
||||||
|
|
||||||
#ifdef WAIT_FOR_L2CAP
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
uint16_t psm;
|
|
||||||
uint16_t mtu;
|
|
||||||
} l2cap_register_service;
|
|
||||||
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
bd_addr_t bd_addr;
|
|
||||||
uint16_t psm;
|
|
||||||
} l2cap_create_channel;
|
|
||||||
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
uint16_t cid;
|
|
||||||
} l2cap_accept_connection;
|
|
||||||
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
uint16_t cid;
|
|
||||||
uint8_t reason;
|
|
||||||
} l2cap_decline_connection;
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -125,16 +97,6 @@ void btpad_queue_process()
|
|||||||
cmd->hci_remote_name_request.reserved, cmd->hci_remote_name_request.clock_offset);
|
cmd->hci_remote_name_request.reserved, cmd->hci_remote_name_request.clock_offset);
|
||||||
else if (cmd->command == hci_pin_code_request_reply_ptr)
|
else if (cmd->command == hci_pin_code_request_reply_ptr)
|
||||||
bt_send_cmd_ptr(cmd->command, cmd->hci_pin_code_request_reply.bd_addr, 6, cmd->hci_pin_code_request_reply.pin);
|
bt_send_cmd_ptr(cmd->command, cmd->hci_pin_code_request_reply.bd_addr, 6, cmd->hci_pin_code_request_reply.pin);
|
||||||
#ifdef WAIT_FOR_L2CAP
|
|
||||||
else if (cmd->command == l2cap_register_service_ptr)
|
|
||||||
bt_send_cmd_ptr(cmd->command, cmd->l2cap_register_service.psm, cmd->l2cap_register_service.mtu);
|
|
||||||
else if (cmd->command == l2cap_create_channel_ptr)
|
|
||||||
bt_send_cmd_ptr(cmd->command, cmd->l2cap_create_channel.bd_addr, cmd->l2cap_create_channel.psm);
|
|
||||||
else if (cmd->command == l2cap_accept_connection_ptr)
|
|
||||||
bt_send_cmd_ptr(cmd->command, cmd->l2cap_accept_connection.cid);
|
|
||||||
else if (cmd->command == l2cap_decline_connection_ptr)
|
|
||||||
bt_send_cmd_ptr(cmd->command, cmd->l2cap_decline_connection.cid, cmd->l2cap_decline_connection.reason);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
INCPOS(read);
|
INCPOS(read);
|
||||||
}
|
}
|
||||||
@ -212,72 +174,3 @@ void btpad_queue_hci_pin_code_request_reply(bd_addr_t bd_addr, bd_addr_t pin)
|
|||||||
btpad_queue_process();
|
btpad_queue_process();
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: It seems the l2cap commands don't need to wait
|
|
||||||
#ifdef WAIT_FOR_L2CAP
|
|
||||||
void btpad_queue_l2cap_register_service(uint16_t psm, uint16_t mtu)
|
|
||||||
{
|
|
||||||
struct btpad_queue_command* cmd = &commands[insert_position];
|
|
||||||
|
|
||||||
cmd->command = l2cap_register_service_ptr;
|
|
||||||
cmd->l2cap_register_service.psm = psm;
|
|
||||||
cmd->l2cap_register_service.mtu = mtu;
|
|
||||||
|
|
||||||
INCPOS(insert);
|
|
||||||
btpad_queue_process();
|
|
||||||
}
|
|
||||||
|
|
||||||
void btpad_queue_l2cap_create_channel(bd_addr_t bd_addr, uint16_t psm)
|
|
||||||
{
|
|
||||||
struct btpad_queue_command* cmd = &commands[insert_position];
|
|
||||||
|
|
||||||
cmd->command = l2cap_create_channel_ptr;
|
|
||||||
memcpy(cmd->l2cap_create_channel.bd_addr, bd_addr, sizeof(bd_addr_t));
|
|
||||||
cmd->l2cap_create_channel.psm = psm;
|
|
||||||
|
|
||||||
INCPOS(insert);
|
|
||||||
btpad_queue_process();
|
|
||||||
}
|
|
||||||
|
|
||||||
void btpad_queue_l2cap_accept_connection(uint16_t cid)
|
|
||||||
{
|
|
||||||
struct btpad_queue_command* cmd = &commands[insert_position];
|
|
||||||
|
|
||||||
cmd->command = l2cap_accept_connection_ptr;
|
|
||||||
cmd->l2cap_accept_connection.cid = cid;
|
|
||||||
|
|
||||||
INCPOS(insert);
|
|
||||||
btpad_queue_process();
|
|
||||||
}
|
|
||||||
|
|
||||||
void btpad_queue_l2cap_decline_connection(uint16_t cid, uint8_t reason)
|
|
||||||
{
|
|
||||||
struct btpad_queue_command* cmd = &commands[insert_position];
|
|
||||||
|
|
||||||
cmd->command = l2cap_decline_connection_ptr;
|
|
||||||
cmd->l2cap_decline_connection.cid = cid;
|
|
||||||
cmd->l2cap_decline_connection.reason = reason;
|
|
||||||
|
|
||||||
INCPOS(insert);
|
|
||||||
btpad_queue_process();
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
void btpad_queue_l2cap_register_service(uint16_t psm, uint16_t mtu)
|
|
||||||
{
|
|
||||||
bt_send_cmd_ptr(l2cap_register_service_ptr, psm, mtu);
|
|
||||||
}
|
|
||||||
|
|
||||||
void btpad_queue_l2cap_create_channel(bd_addr_t bd_addr, uint16_t psm)
|
|
||||||
{
|
|
||||||
bt_send_cmd_ptr(l2cap_create_channel_ptr, bd_addr, psm);
|
|
||||||
}
|
|
||||||
|
|
||||||
void btpad_queue_l2cap_accept_connection(uint16_t cid)
|
|
||||||
{
|
|
||||||
bt_send_cmd_ptr(l2cap_accept_connection_ptr, cid);
|
|
||||||
}
|
|
||||||
|
|
||||||
void btpad_queue_l2cap_decline_connection(uint16_t cid, uint8_t reason)
|
|
||||||
{
|
|
||||||
bt_send_cmd_ptr(l2cap_decline_connection_ptr, cid, reason);
|
|
||||||
}
|
|
||||||
#endif
|
|
@ -26,9 +26,5 @@ void btpad_queue_hci_disconnect(uint16_t handle, uint8_t reason);
|
|||||||
void btpad_queue_hci_inquiry(uint32_t lap, uint8_t length, uint8_t num_responses);
|
void btpad_queue_hci_inquiry(uint32_t lap, uint8_t length, uint8_t num_responses);
|
||||||
void btpad_queue_hci_remote_name_request(bd_addr_t bd_addr, uint8_t page_scan_repetition_mode, uint8_t reserved, uint16_t clock_offset);
|
void btpad_queue_hci_remote_name_request(bd_addr_t bd_addr, uint8_t page_scan_repetition_mode, uint8_t reserved, uint16_t clock_offset);
|
||||||
void btpad_queue_hci_pin_code_request_reply(bd_addr_t bd_addr, bd_addr_t pin);
|
void btpad_queue_hci_pin_code_request_reply(bd_addr_t bd_addr, bd_addr_t pin);
|
||||||
void btpad_queue_l2cap_register_service(uint16_t psm, uint16_t mtu);
|
|
||||||
void btpad_queue_l2cap_create_channel(bd_addr_t bd_addr, uint16_t psm);
|
|
||||||
void btpad_queue_l2cap_accept_connection(uint16_t cid);
|
|
||||||
void btpad_queue_l2cap_decline_connection(uint16_t cid, uint8_t reason);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user