diff options
| author | Alexander Diewald <Diewi@diewald-net.com> | 2017-10-28 13:34:01 +0200 |
|---|---|---|
| committer | Arian <arian.kulmer@web.de> | 2019-10-28 14:57:36 +0100 |
| commit | 3ce0a40f2582c485f56a0a5e7b4dc452a48bb190 (patch) | |
| tree | c115e0b2e905df4a7b532001f2f2aac8162a27f9 | |
| parent | 2da2991694277c0e29782fbadffe69027adeb09a (diff) | |
brcm-uim-sysfs: Build broadcom-bt-fm daemon with clang.
* Use clang to build the daemon as dictated by the android build
system.
* Fix errors detected by clang.
* Fix several warnings about unused methods and variables as well
as incompatible types.
* Runtime tests succeed: Bluetooth starts on a Sony Xperia Z2 and
the device is able toi receive files (data transfer is OK).
Change-Id: I5192b4589a8e62898aa44faa2696a4ed836e702e
Signed-off-by: Alexander Diewald <Diewi@diewald-net.com>
| -rwxr-xr-x | brcm-uim-sysfs/Android.mk | 1 | ||||
| -rwxr-xr-x | brcm-uim-sysfs/brcm_hci_dump.c | 6 | ||||
| -rwxr-xr-x | brcm-uim-sysfs/btsnoop.c | 9 | ||||
| -rwxr-xr-x | brcm-uim-sysfs/include/utils.h | 5 | ||||
| -rwxr-xr-x | brcm-uim-sysfs/uim.c | 52 | ||||
| -rwxr-xr-x | brcm-uim-sysfs/utils.c | 6 |
6 files changed, 38 insertions, 41 deletions
diff --git a/brcm-uim-sysfs/Android.mk b/brcm-uim-sysfs/Android.mk index dc91a34..48ca6dc 100755 --- a/brcm-uim-sysfs/Android.mk +++ b/brcm-uim-sysfs/Android.mk @@ -14,7 +14,6 @@ LOCAL_SRC_FILES:= \ btsnoop.c \ utils.c -LOCAL_CLANG := false LOCAL_CFLAGS:= -c -W -Wall -O2 -D_POSIX_SOURCE -DUIM_DEBUG -DBLUEDROID_ENABLE_V4L2 LOCAL_SHARED_LIBRARIES:= libnetutils libcutils liblog diff --git a/brcm-uim-sysfs/brcm_hci_dump.c b/brcm-uim-sysfs/brcm_hci_dump.c index bb64857..95cd89d 100755 --- a/brcm-uim-sysfs/brcm_hci_dump.c +++ b/brcm-uim-sysfs/brcm_hci_dump.c @@ -384,7 +384,7 @@ static inline int is_signaled(fd_set* set) /* Read thread for snooping packets from Line discipline driver */ -static void* v4l2_hci_snoop_thread(void* parameters) +static void* v4l2_hci_snoop_thread(__attribute__((unused)) void* parameters) { HC_BT_HDR *p_buf = NULL; fd_set input; @@ -409,7 +409,7 @@ static void* v4l2_hci_snoop_thread(void* parameters) if (sock_fd < 0) { BRCM_HCI_DUMP_ERR("Unable to create netlink socket"); - return -1; + return NULL; } memset(&src_addr, 0, sizeof(src_addr)); @@ -625,7 +625,7 @@ static void* v4l2_hci_snoop_thread(void* parameters) int hci_snoop_bkp_file() { - if (hci_snoop_path != NULL) + if (hci_snoop_path[0] != '\0') { char new_path[256] = {0}; diff --git a/brcm-uim-sysfs/btsnoop.c b/brcm-uim-sysfs/btsnoop.c index 11580ac..f8f5314 100755 --- a/brcm-uim-sysfs/btsnoop.c +++ b/brcm-uim-sysfs/btsnoop.c @@ -468,7 +468,7 @@ void btsnoop_acl_data(uint8_t *p, uint8_t is_rcvd) #define EXT_PARSER_PORT 4330 -static pthread_t thread_id; +__attribute__((unused)) static pthread_t thread_id; static int s_listen = -1; static int ext_parser_fd = -1; @@ -480,7 +480,6 @@ static int ext_parser_accept(int port) struct sockaddr_in cliaddr, servaddr; int s, srvlen; int n = 1; - int size_n; int result = 0; ALOGD("waiting for connection on port %d", port); @@ -533,7 +532,7 @@ static int ext_parser_accept(int port) return s; } -static int send_ext_parser(char *p, int len) +__attribute__((unused)) static int send_ext_parser(char *p, int len) { int n; @@ -567,13 +566,13 @@ static void ext_parser_detached(void) s_listen = -1; } -static void interruptFn (int sig) +static void interruptFn (__attribute__((unused)) int sig) { ALOGD("interruptFn"); pthread_exit(0); } -static void ext_parser_thread(void* param) +__attribute__((unused)) static void ext_parser_thread(__attribute__((unused)) void* param) { int fd; int sig = SIGUSR2; diff --git a/brcm-uim-sysfs/include/utils.h b/brcm-uim-sysfs/include/utils.h index f0e9730..78e97fd 100755 --- a/brcm-uim-sysfs/include/utils.h +++ b/brcm-uim-sysfs/include/utils.h @@ -29,6 +29,7 @@ #ifndef UTILS_H #define UTILS_H +#include "btsnoop.h" /****************************************************************************** @@ -91,7 +92,7 @@ void utils_cleanup (); ** Returns None ** *******************************************************************************/ -static void utils_queue_init (BUFFER_Q *p_q); +__attribute__((unused)) static void utils_queue_init (BUFFER_Q *p_q); /******************************************************************************* ** @@ -215,7 +216,7 @@ uint8_t* utils_alloc (int size); ** ** Returns None+** *******************************************************************************/ -void utils_release(uint8_t* ptr); +void utils_release(HC_BT_HDR* ptr); /******************************************************************************* ** diff --git a/brcm-uim-sysfs/uim.c b/brcm-uim-sysfs/uim.c index db24ee2..3c30411 100755 --- a/brcm-uim-sysfs/uim.c +++ b/brcm-uim-sysfs/uim.c @@ -61,6 +61,7 @@ #include <cutils/misc.h> #endif +#undef LOG_TAG #define LOG_TAG "brcm-uim" #define UIM_DEBUG 1 @@ -138,7 +139,6 @@ btuim_lpm_param_t lpm_uim_param = int pass_vendor_params() { int fd_vendor_params = 0; - int len; fd_vendor_params = open(LDISC_VENDOR_PARAMS, O_WRONLY); if (fd_vendor_params > 0) @@ -609,10 +609,10 @@ static inline void err_cleanup(int st_fd) #ifdef ANDROID /* library for android to do insmod/rmmod */ -/*****************************************************************************/ -/* Function to insert the kernel module into the system - ****************************************************************************/ -static int insmod(const char *filename, const char *args) +/*************************************************************************** +* Function to insert the kernel module into the system +****************************************************************************/ +__attribute__((unused)) static int insmod(const char *filename, const char *args) { void *module; unsigned int size; @@ -635,10 +635,10 @@ static int insmod(const char *filename, const char *args) } -/*****************************************************************************/ -/* Function to remove the kernel module from the system -****************************************************************************/ -static int rmmod(const char *modname) +/***************************************************************************** + * Function to remove the kernel module from the system +*****************************************************************************/ +__attribute__((unused)) static int rmmod(const char *modname) { int ret = -1; int maxtry = MAX_TRY; @@ -664,13 +664,13 @@ static int rmmod(const char *modname) -/*****************************************************************************/ -/* Function to read the HCI event from the given file descriptor +/**************************************************************************** + * Function to read the HCI event from the given file descriptor * * This will parse the response received and returns error * if the required response is not received - */ -int read_hci_event(int fd, unsigned char *buf, int size) + ****************************************************************************/ +int read_hci_event(int fd, char *buf, int size) { int remain, rd; int count = 0; @@ -738,7 +738,7 @@ static int read_command_complete(int fd, unsigned short opcode) UIM_START_FUNC(); UIM_VER(" Command complete started"); - if (read_hci_event(fd, (unsigned char *)&resp, sizeof(resp)) < 0) { + if (read_hci_event(fd, (char *)&resp, sizeof(resp)) < 0) { UIM_ERR(" Invalid response"); return -1; } @@ -797,8 +797,7 @@ BRCM_encode_baud_rate(uint baud_rate, unsigned char *encoded_baud) encoded_baud[0] = (unsigned char)(baud_rate & 0xFF); } -void -BRCM_encode_bd_address( unsigned char *bd_addrr) +void BRCM_encode_bd_address( unsigned char *bd_addrr) { if(bd_addrr == NULL) { fprintf(stderr, "BD addr not supported!"); @@ -858,8 +857,9 @@ validate_baudrate(int baud_rate, int *value) *****************************************************************************/ static int proc_set_lpm_param() { - const char hci_writesleepmode_cmd[] = {0x01, 0x27, 0xFC, 0x0C, 0x00,0x00,0x001,\ - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + char hci_writesleepmode_cmd[] = {0x01, 0x27, 0xFC, 0x0C, 0x00, 0x00, 0x01,\ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00}; char cmd[100]; UIM_DBG("lpmenable %d",lpmenable); char *temp = hci_writesleepmode_cmd; @@ -867,14 +867,14 @@ static int proc_set_lpm_param() if(lpmenable) { memcpy((temp+4), &lpm_uim_param, LPM_CMD_PARAM_SIZE); UIM_DBG("%s lpm is enabled", __func__); - } - else + } else { memset((temp+4), 0, LPM_CMD_PARAM_SIZE); + } sprintf(cmd, "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x", temp[0], temp[1], temp[2],temp[3], temp[4], temp[5], temp[6], temp[7], temp[8],temp[9], temp[10], temp[11], - temp[12], temp[13], temp[14],temp[15]); + temp[12], temp[13], temp[14], temp[15]); strcat(hw_cfg_string , cmd); return 0; } @@ -1061,8 +1061,8 @@ static uint8_t hw_config_findpatch(char *p_chip_id_str) static uint8_t proc_read_local_name(char* p_chip_id_str) { - unsigned char hci_read_localname[] = { 0x01, 0x14, 0x0C, 0x00 }; - unsigned char buff[READ_LOCALNAME_RESP_BUFF_SIZE]; + char hci_read_localname[] = { 0x01, 0x14, 0x0C, 0x00 }; + char buff[READ_LOCALNAME_RESP_BUFF_SIZE]; char *p_name, *p_tmp; int len, i; @@ -1400,8 +1400,6 @@ void read_default_bdaddr(bdaddr_t *local_addr) int main(void) { int st_fd, err; - struct stat file_stat; - char kmodule_path[MAX_KMODULE_PATH_SIZE] = {0}; struct pollfd p; unsigned char install; @@ -1409,14 +1407,14 @@ int main(void) err = 0; /* Read configuration parameters for hardware config */ - if (vnd_load_conf(VENDOR_LIB_CONF_FILE, &vendor_conf_table)) + if (vnd_load_conf(VENDOR_LIB_CONF_FILE, &vendor_conf_table[0])) { return UIM_FAIL; } #if V4L2_SNOOP_ENABLE /* Read configuration parameters for hci snoop */ - if (vnd_load_conf(STACK_CONF_FILE, &stack_conf_table)) + if (vnd_load_conf(STACK_CONF_FILE, &stack_conf_table[0])) { return UIM_FAIL; } diff --git a/brcm-uim-sysfs/utils.c b/brcm-uim-sysfs/utils.c index 0f9d46a..072c923 100755 --- a/brcm-uim-sysfs/utils.c +++ b/brcm-uim-sysfs/utils.c @@ -155,11 +155,11 @@ uint8_t* utils_alloc (int size) ** Returns None ** *******************************************************************************/ -void utils_release(uint8_t* ptr) +void utils_release(HC_BT_HDR* ptr) { - uint8_t* p; + HC_BT_HDR* p; - p = (uint8_t*)ptr - BT_HC_BUFFER_HDR_SIZE; + p = ptr - BT_HC_BUFFER_HDR_SIZE; free(p); } |
