diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2006-06-04 15:27:17 +0000 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2006-06-04 15:27:17 +0000 |
commit | 99dd5f8c7549a7e7f4183bd8040c3e0e8884594f (patch) | |
tree | 97253069154bf740bec09f9a0228c5a5d3b4675c /tools | |
parent | 11d3cfa9cb0e5c78f6788443e824a25922a12d30 (diff) |
Load firmware files from /lib/firmware
Diffstat (limited to 'tools')
-rw-r--r-- | tools/hciattach_st.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/tools/hciattach_st.c b/tools/hciattach_st.c index 0279d398..46efbc2c 100644 --- a/tools/hciattach_st.c +++ b/tools/hciattach_st.c @@ -115,7 +115,7 @@ static int load_file(int dd, uint16_t version, const char *suffix) { DIR *dir; struct dirent *d; - char filename[NAME_MAX], prefix[20]; + char pathname[PATH_MAX], filename[NAME_MAX], prefix[20]; unsigned char cmd[256]; unsigned char buf[256]; uint8_t seqnum = 0; @@ -126,9 +126,14 @@ static int load_file(int dd, uint16_t version, const char *suffix) snprintf(prefix, sizeof(prefix), "STLC2500_R%d_%02d_", version >> 8, version & 0xff); - dir = opendir("."); - if (!dir) - return -errno; + strcpy(pathname, "/lib/firmware"); + dir = opendir(pathname); + if (!dir) { + strcpy(pathname, "."); + dir = opendir(pathname); + if (!dir) + return -errno; + } while (1) { d = readdir(dir); @@ -142,7 +147,8 @@ static int load_file(int dd, uint16_t version, const char *suffix) if (strncmp(d->d_name, prefix, strlen(prefix))) continue; - snprintf(filename, sizeof(filename), "%s", d->d_name); + snprintf(filename, sizeof(filename), "%s/%s", + pathname, d->d_name); } closedir(dir); |