Skip to content

Commit

Permalink
tools: Make hciattach_* firmware path build-time configurable
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Marek Vasut authored and Vudentz committed Nov 1, 2022
1 parent b3f76b3 commit d925324
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
4 changes: 4 additions & 0 deletions tools/hciattach.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@
#define HCI_UART_EXT_CONFIG 4
#define HCI_UART_VND_DETECT 5

#ifndef FIRMWARE_DIR
#define FIRMWARE_DIR "/etc/firmware"
#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);
Expand Down
4 changes: 0 additions & 4 deletions tools/hciattach_bcm43xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@

#include "hciattach.h"

#ifndef FIRMWARE_DIR
#define FIRMWARE_DIR "/etc/firmware"
#endif

#define FW_EXT ".hcd"

#define BCM43XX_CLOCK_48 1
Expand Down
3 changes: 2 additions & 1 deletion tools/hciattach_qualcomm.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,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]);
Expand Down
3 changes: 2 additions & 1 deletion tools/hciattach_tialt.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,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);

Expand Down

0 comments on commit d925324

Please sign in to comment.