tools: Make hciattach_* firmware path build-time configurable
authorMarek Vasut <marex@denx.de>
Tue, 1 Nov 2022 11:53:33 +0000 (12:53 +0100)
committerAyush Garg <ayush.garg@samsung.com>
Mon, 15 May 2023 09:25:55 +0000 (14:55 +0530)
Make hciattach_qualcomm.c and hciattach_tialt.c behave the same way
as hciattach_bcm43xx.c does, where FIRMWARE_DIR can be overridden
at build time by using -DFIRMWARE_DIR= CFLAGS.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
tools/hciattach.h
tools/hciattach_bcm43xx.c
tools/hciattach_qualcomm.c
tools/hciattach_tialt.c

index dda33db..53e29b2 100755 (executable)
 #define HCI_UART_EXT_CONFIG    4
 #define HCI_UART_VND_DETECT    5
 
+#ifndef FIRMWARE_DIR
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+#define FIRMWARE_DIR "/usr/etc/bluetooth"
+#else
+#define FIRMWARE_DIR "/etc/firmware"
+#endif
+#endif
+
 int read_hci_event(int fd, unsigned char *buf, int size);
 int set_speed(int fd, struct termios *ti, int speed);
 int uart_speed(int speed);
index 2f6467c..7fbeec1 100755 (executable)
 
 #include "hciattach.h"
 
-#ifndef FIRMWARE_DIR
-#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
-#define FIRMWARE_DIR "/usr/etc/bluetooth"
-#else
-#define FIRMWARE_DIR "/etc/firmware"
-#endif
-#endif
-
 #define FW_EXT ".hcd"
 
 #define BCM43XX_CLOCK_48 1
index 231ca72..2fcf54b 100755 (executable)
@@ -221,7 +221,8 @@ int qualcomm_init(int fd, int speed, struct termios *ti, const char *bdaddr)
 
        } while (resp[3] != 0 && resp[4] != 2);
 
-       snprintf(fw, sizeof(fw), "/etc/firmware/%c%c%c%c%c%c_%c%c%c%c.bin",
+       snprintf(fw, sizeof(fw), "%s/%c%c%c%c%c%c_%c%c%c%c.bin",
+                               FIRMWARE_DIR,
                                resp[18], resp[19], resp[20], resp[21],
                                resp[22], resp[23],
                                resp[32], resp[33], resp[34], resp[35]);
index a7e02c7..fa9efb4 100755 (executable)
@@ -220,7 +220,8 @@ int texasalt_init(int fd, int speed, struct termios *ti)
                                ((brf_chip > 7) ? "unknown" : c_brf_chip[brf_chip]),
                                brf_chip);
 
-               sprintf(fw, "/etc/firmware/%s.bin",
+               sprintf(fw, "%s/%s.bin",
+                       FIRMWARE_DIR,
                        (brf_chip > 7) ? "unknown" : c_brf_chip[brf_chip]);
                texas_load_firmware(fd, fw);