Re: [Bluez-devel] [PATCH] STLC2500 updated patch

Fabien Chevalier
2007-10-08T12:38:46Z

[-- Attachment #1: Type: text/plain, Size: 206 bytes --]

And finally the last of the list:

* Makes the firmware & parameters download optional : even though those
are supposed to be mandatory, practive shows that the chip can run
without them.

Cheers,

Fabien

[-- Attachment #2: hciattach-stl2500-cleanup-and-fix-4.patch --]
[-- Type: text/x-patch, Size: 1474 bytes --]

--- tools/hciattach_st.c 2007-10-08 13:47:07.000000000 +0200
+++ ../tools/hciattach_st.c 2007-10-08 14:35:41.000000000 +0200
@@ -122,7 +122,7 @@
unsigned char cmd[256];
unsigned char buf[256];
uint8_t seqnum = 0;
- int fd, size, len;
+ int fd, size, len, found_fw_file;

memset(filename, 0, sizeof(filename));

@@ -138,6 +138,7 @@
return -errno;
}

+ found_fw_file = 0;
while (1) {
d = readdir(dir);
if (!d)
@@ -152,10 +153,14 @@

snprintf(filename, sizeof(filename), "%s/%s",
pathname, d->d_name);
+ found_fw_file = 1;
}

closedir(dir);

+ if (!found_fw_file)
+ return -ENOENT;
+
printf("Loading file %s\n", filename);

fd = open(filename, O_RDONLY);
@@ -194,6 +199,7 @@
unsigned char buf[254];
uint16_t version;
int len;
+ int err;

/* Hci_Cmd_Ericsson_Read_Revision_Information */
len = do_command(dd, 0xff, 0x000f, NULL, 0, buf, sizeof(buf));
@@ -209,11 +215,21 @@

version = buf[2] << 8 | buf[1];

- if (load_file(dd, version, ".ptc") < 0)
- return -1;
+ err = load_file(dd, version, ".ptc");
+ if (err < 0) {
+ if (err == -ENOENT)
+ fprintf(stderr, "No ROM patch file loaded.\n");
+ else
+ return -1;
+ }

- if (load_file(dd, buf[2] << 8 | buf[1], ".ssf") < 0)
- return -1;
+ err = load_file(dd, buf[2] << 8 | buf[1], ".ssf");
+ if (err < 0) {
+ if (err == -ENOENT)
+ fprintf(stderr, "No static settings file loaded.\n");
+ else
+ return -1;
+ }

cmd[0] = 0xfe;
cmd[1] = 0x06;

[-- Attachment #3: fchevalier.vcf --]
[-- Type: text/x-vcard, Size: 242 bytes --]