aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorroot <root@lamia.panaceas.james.local>2015-09-04 10:30:45 +0100
committerroot <root@lamia.panaceas.james.local>2015-09-04 10:30:45 +0100
commitb0ad49a7b57b8e567d84e99e37033506af2678cb (patch)
tree8986c8159e6fb486f240f36a3686bdda0dbca4b7
parent80897e1b5cfc81547e98d830471b78d210997bea (diff)
downloadnrfdfu-b0ad49a7b57b8e567d84e99e37033506af2678cb.tar.gz
nrfdfu-b0ad49a7b57b8e567d84e99e37033506af2678cb.tar.bz2
nrfdfu-b0ad49a7b57b8e567d84e99e37033506af2678cb.zip
noresp writes are ignored by dfu firmware
-rw-r--r--ble.c15
-rw-r--r--dfu.c3
-rw-r--r--nrfdfu.c1
3 files changed, 17 insertions, 2 deletions
diff --git a/ble.c b/ble.c
index 24871b9..5de6993 100644
--- a/ble.c
+++ b/ble.c
@@ -553,13 +553,13 @@ ble_send_cp (BLE * ble, uint8_t * buf, size_t len)
}
-
int
ble_send_cp_noresp (BLE * ble, uint8_t * buf, size_t len)
{
- printf ("Sending control:\n");
+ printf ("Sending control (but ignoring error):\n");
hexdump (buf, len);
+#if 0
if (!bt_gatt_client_write_without_response
(ble->gatt, ble->cp_handle, false, buf, len))
{
@@ -567,6 +567,17 @@ ble_send_cp_noresp (BLE * ble, uint8_t * buf, size_t len)
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
+#else
+ if (!bt_gatt_client_write_value (ble->gatt, ble->cp_handle, buf, len,
+ write_cb, ble, NULL))
+ {
+ printf ("Failed to initiate write procedure\n");
+ return EXIT_FAILURE;
+ }
+
+ mainloop_run ();
+ return EXIT_SUCCESS;
+#endif
}
diff --git a/dfu.c b/dfu.c
index 4dedc08..7a72e9a 100644
--- a/dfu.c
+++ b/dfu.c
@@ -217,6 +217,9 @@ dfu (const char *bdaddr, const char *type, const char *version, uint8_t * dat,
break;
#endif
+ buf[0] = OP_CODE_IMAGE_SIZE_REQ;
+ ble_send_cp (b, buf, 1);
+
ble_wait_setup (b, OP_CODE_VALIDATE);
buf[0] = OP_CODE_VALIDATE;
if (ble_send_cp (b, buf, 1))
diff --git a/nrfdfu.c b/nrfdfu.c
index 81d94da..c46a42d 100644
--- a/nrfdfu.c
+++ b/nrfdfu.c
@@ -76,6 +76,7 @@ main (int argc, char *argv[])
if (!dfu
(bdaddr, m->type, m->dfu_version, dat, dat_size, bin, bin_size))
return EXIT_SUCCESS;
+ sleep(3);
}