-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Additional missing-prototypes fixes #5563
Additional missing-prototypes fixes #5563
Conversation
I think this correctly enables missing-prototypes in atmel-samd and raspberrypi ports.
9fefe30
to
340d6b9
Compare
int att_find_info_req(uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle, uint8_t response_buffer[]) { | ||
struct __packed req { | ||
struct bt_att_hdr h; | ||
struct bt_att_find_info_req r; | ||
} req = { { | ||
.code = BT_ATT_OP_FIND_INFO_REQ, | ||
}, { | ||
.start_handle = start_handle, | ||
.end_handle = end_handle, | ||
}}; | ||
|
||
return send_req_wait_for_rsp(conn_handle, sizeof(req), (uint8_t *)&req, response_buffer); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't delete this; the _bleio HCI implementation is incomplete and this may be needed later. Let's just comment it out for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Requesting to comment out instead of deleting unused code in _bleio HCI so we don't lose track of it. When we get around to implementing _bleio HCI central mode, we may need this code.
int att_read_group_req(uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle, uint16_t uuid, uint8_t response_buffer[]) { | ||
|
||
typedef struct __packed { | ||
struct bt_att_hdr h; | ||
struct bt_att_read_group_req r; | ||
} req_t; | ||
|
||
uint8_t req_bytes[sizeof(req_t) + sizeof(uuid)]; | ||
req_t *req = (req_t *)req_bytes; | ||
|
||
req->h.code = BT_ATT_OP_READ_GROUP_REQ; | ||
req->r.start_handle = start_handle; | ||
req->r.end_handle = end_handle; | ||
req->r.uuid[0] = uuid & 0xff; | ||
req->r.uuid[1] = uuid >> 8; | ||
|
||
return send_req_wait_for_rsp(conn_handle, sizeof(req_bytes), req_bytes, response_buffer); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't delete this; the _bleio HCI implementation is incomplete and this may be needed later. Let's just comment it out for now.
int att_read_type_req(uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle, uint16_t type, uint8_t response_buffer[]) { | ||
typedef struct __packed { | ||
struct bt_att_hdr h; | ||
struct bt_att_read_type_req r; | ||
} req_t; | ||
|
||
uint8_t req_bytes[sizeof(req_t) + sizeof(type)]; | ||
req_t *req = (req_t *)req_bytes; | ||
|
||
req->h.code = BT_ATT_OP_READ_TYPE_REQ; | ||
req->r.start_handle = start_handle; | ||
req->r.end_handle = end_handle; | ||
req->r.uuid[0] = type & 0xff; | ||
req->r.uuid[1] = type >> 8; | ||
|
||
return send_req_wait_for_rsp(conn_handle, sizeof(req_bytes), req_bytes, response_buffer); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't delete this; the _bleio HCI implementation is incomplete and this may be needed later. Let's just comment it out for now.
|
||
// FIX Do we need all of these? | ||
void check_att_err(uint8_t err) { | ||
const compressed_string_t *msg = NULL; | ||
switch (err) { | ||
case 0: | ||
return; | ||
case BT_ATT_ERR_INVALID_HANDLE: | ||
msg = translate("Invalid handle"); | ||
break; | ||
case BT_ATT_ERR_READ_NOT_PERMITTED: | ||
msg = translate("Read not permitted"); | ||
break; | ||
case BT_ATT_ERR_WRITE_NOT_PERMITTED: | ||
msg = translate("Write not permitted"); | ||
break; | ||
case BT_ATT_ERR_INVALID_PDU: | ||
msg = translate("Invalid PDU"); | ||
break; | ||
case BT_ATT_ERR_NOT_SUPPORTED: | ||
msg = translate("Not supported"); | ||
break; | ||
case BT_ATT_ERR_INVALID_OFFSET: | ||
msg = translate("Invalid offset"); | ||
break; | ||
case BT_ATT_ERR_PREPARE_QUEUE_FULL: | ||
msg = translate("Prepare queue full"); | ||
break; | ||
case BT_ATT_ERR_ATTRIBUTE_NOT_FOUND: | ||
msg = translate("Attribute not found"); | ||
break; | ||
case BT_ATT_ERR_ATTRIBUTE_NOT_LONG: | ||
msg = translate("Attribute not long"); | ||
break; | ||
case BT_ATT_ERR_ENCRYPTION_KEY_SIZE: | ||
msg = translate("Encryption key size"); | ||
break; | ||
case BT_ATT_ERR_INVALID_ATTRIBUTE_LEN: | ||
msg = translate("Invalid attribute length"); | ||
break; | ||
case BT_ATT_ERR_UNLIKELY: | ||
msg = translate("Unlikely"); | ||
break; | ||
case BT_ATT_ERR_UNSUPPORTED_GROUP_TYPE: | ||
msg = translate("Unsupported group type"); | ||
break; | ||
case BT_ATT_ERR_INSUFFICIENT_RESOURCES: | ||
msg = translate("Insufficient resources"); | ||
break; | ||
case BT_ATT_ERR_DB_OUT_OF_SYNC: | ||
msg = translate("DB out of sync"); | ||
break; | ||
case BT_ATT_ERR_VALUE_NOT_ALLOWED: | ||
msg = translate("Value not allowed"); | ||
break; | ||
} | ||
if (msg) { | ||
mp_raise_bleio_BluetoothError(msg); | ||
} | ||
|
||
switch (err) { | ||
case BT_ATT_ERR_AUTHENTICATION: | ||
msg = translate("Insufficient authentication"); | ||
break; | ||
case BT_ATT_ERR_INSUFFICIENT_ENCRYPTION: | ||
msg = translate("Insufficient encryption"); | ||
break; | ||
} | ||
if (msg) { | ||
mp_raise_bleio_SecurityError(msg); | ||
} | ||
|
||
mp_raise_bleio_BluetoothError(translate("Unknown ATT error: 0x%02x"), err); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't delete this; the _bleio HCI implementation is incomplete and this may be needed later. Let's just comment it out for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reverted these changes. Instead, I marked the functions as static but deactivated the diagnostic for unused functions. This should be the most effective way to ensure the functions' code doesn't go into binaries, while leaving the code available for the future when it's needed.
It's finally green! 🎉 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this cleanup!
This continues in the vein of #5561 which was incomplete due to an error in a Makefile.
I think this correctly enables missing-prototypes diagnostics (as errors) in atmel-samd, espressif and raspberrypi ports.
Future work can enable this in the remaining ports.