mirror of
https://github.com/libretro/RetroArch
synced 2025-02-04 03:40:03 +00:00
(iOS) Add some error logging to BTpad code. Also add some controller pairing info to ios/README.md
This commit is contained in:
parent
d67fc02b26
commit
bd2f308f46
@ -72,3 +72,21 @@ iTunes File Sharing is enabled on RetroArch. You can simply drag your rom files
|
||||
|
||||
Alternatively, you can use something like [iExplorer](http://www.macroplant.com/iexplorer) to manually copy files over. Doing this will give you the benefit of being able to use diretories, since iTunes File Sharing does not support directories.
|
||||
|
||||
## BTstack (Jailbreak only)
|
||||
|
||||
With the BTstack cydia package installed both WiiMote and PS3 Pads are usable. To enable BTstack usage tap the Settings button in the upper left corner and turn on the 'Enable BTstack' option.
|
||||
|
||||
### Connecting a WiiMote
|
||||
|
||||
Press both the 1 and 2 buttons on the WiiMote at the same time. The WiiMote is successfully completed when the 4 lights stop flashing.
|
||||
|
||||
### Connecting PS3
|
||||
|
||||
Before a PS3 pad can be used it must be manually paired with your device using a PC, USB cable, and a special piece of software.
|
||||
|
||||
The pairing software will likely ask for the bluetooth address of your device, this can be found under the 'Diagnostic Log' option in the settings menu.
|
||||
|
||||
The line will appear as:
|
||||
```
|
||||
BTpad: Local address is XX:XX:XX:XX:XX:XX
|
||||
```
|
||||
|
@ -31,6 +31,7 @@ static struct
|
||||
{
|
||||
GRAB(bt_open),
|
||||
GRAB(bt_flip_addr),
|
||||
GRAB(bd_addr_to_str),
|
||||
GRAB(bt_register_packet_handler),
|
||||
GRAB(bt_send_cmd),
|
||||
GRAB(bt_send_l2cap),
|
||||
@ -41,6 +42,7 @@ static struct
|
||||
GRAB(btstack_set_system_bluetooth_enabled),
|
||||
GRAB(hci_delete_stored_link_key),
|
||||
GRAB(hci_disconnect),
|
||||
GRAB(hci_read_bd_addr),
|
||||
GRAB(hci_inquiry),
|
||||
GRAB(hci_inquiry_cancel),
|
||||
GRAB(hci_pin_code_request_reply),
|
||||
|
@ -34,6 +34,7 @@ bool btstack_is_running();
|
||||
|
||||
BTDIMPORT int (*bt_open_ptr)(void);
|
||||
BTDIMPORT void (*bt_flip_addr_ptr)(bd_addr_t dest, bd_addr_t src);
|
||||
BTDIMPORT char* (*bd_addr_to_str_ptr)(bd_addr_t addr);
|
||||
BTDIMPORT btstack_packet_handler_t (*bt_register_packet_handler_ptr)(btstack_packet_handler_t handler);
|
||||
BTDIMPORT int (*bt_send_cmd_ptr)(const hci_cmd_t *cmd, ...);
|
||||
BTDIMPORT void (*bt_send_l2cap_ptr)(uint16_t local_cid, uint8_t *data, uint16_t len);
|
||||
@ -45,6 +46,7 @@ BTDIMPORT const hci_cmd_t* btstack_set_power_mode_ptr;
|
||||
BTDIMPORT const hci_cmd_t* btstack_set_system_bluetooth_enabled_ptr;
|
||||
BTDIMPORT const hci_cmd_t* hci_delete_stored_link_key_ptr;
|
||||
BTDIMPORT const hci_cmd_t* hci_disconnect_ptr;
|
||||
BTDIMPORT const hci_cmd_t* hci_read_bd_addr_ptr;
|
||||
BTDIMPORT const hci_cmd_t* hci_inquiry_ptr;
|
||||
BTDIMPORT const hci_cmd_t* hci_inquiry_cancel_ptr;
|
||||
BTDIMPORT const hci_cmd_t* hci_pin_code_request_reply_ptr;
|
||||
|
@ -82,8 +82,8 @@ static void btpad_connect_pad()
|
||||
btpad_disconnect_pad();
|
||||
memset(&btpad_connection, 0, sizeof(btpad_connection_t));
|
||||
|
||||
ios_add_log_message("BTpad: Registering HID INTERRUPT service");
|
||||
bt_send_cmd_ptr(l2cap_register_service_ptr, PSM_HID_INTERRUPT, 672);
|
||||
ios_add_log_message("BTpad: Requesting local address");
|
||||
bt_send_cmd_ptr(hci_read_bd_addr_ptr);
|
||||
}
|
||||
|
||||
void btpad_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size)
|
||||
@ -101,10 +101,28 @@ void btpad_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet
|
||||
btpad_disconnect_pad();
|
||||
break;
|
||||
|
||||
case HCI_EVENT_COMMAND_COMPLETE:
|
||||
if (COMMAND_COMPLETE_EVENT(packet, (*hci_read_bd_addr_ptr)))
|
||||
{
|
||||
if (packet[5])
|
||||
ios_add_log_message("BTpad: Failed to get local address (E: %02X)", packet[5]);
|
||||
else
|
||||
{
|
||||
bt_flip_addr_ptr(event_addr, &packet[6]);
|
||||
ios_add_log_message("BTpad: Local address is %s", bd_addr_to_str_ptr(event_addr));
|
||||
}
|
||||
|
||||
ios_add_log_message("BTpad: Registering HID INTERRUPT service");
|
||||
bt_send_cmd_ptr(l2cap_register_service_ptr, PSM_HID_INTERRUPT, 672);
|
||||
}
|
||||
break;
|
||||
|
||||
case L2CAP_EVENT_SERVICE_REGISTERED:
|
||||
{
|
||||
uint32_t psm = READ_BT_16(packet, 3);
|
||||
if (psm == PSM_HID_INTERRUPT)
|
||||
if (packet[2])
|
||||
ios_add_log_message("BTpad: Failed to register HID service (PSM: %02X, E: %02X)", psm, packet[2]);
|
||||
else if (psm == PSM_HID_INTERRUPT)
|
||||
{
|
||||
ios_add_log_message("BTpad: HID INTERRUPT service registered");
|
||||
ios_add_log_message("BTpad: Registering HID CONTROL service");
|
||||
@ -195,7 +213,7 @@ void btpad_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet
|
||||
ios_add_log_message("BTpad: Got unknown L2CAP channel, ignoring");
|
||||
}
|
||||
else
|
||||
ios_add_log_message("BTpad: Failed to open WiiMote L2CAP channel for PSM: %02X", psm);
|
||||
ios_add_log_message("BTpad: Failed to open WiiMote L2CAP channel (PSM: %02X, E: %02X)", psm, status);
|
||||
}
|
||||
break;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user