summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Stefan Richter 2009-01-11 22:44:11 +0100
committerGravatar Stefan Richter 2009-05-30 10:17:43 +0200
commitda5156af5a5b779b6713ab7dff569a10927ed188 (patch)
treeb7c0e9e66c4c75721801c9a11347ebba5c2ddf57
parenttestlibraw: fix printing of local config ROM (diff)
Use new broadcast request ioctl
This implements broadcast transactions on juju. (Broadcast transactions are write transactions to PHY ID 63, not to be confused with isochronous or asynchronous streams.) Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
-rw-r--r--src/fw.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/fw.c b/src/fw.c
index 0b6ed67..9b33422 100644
--- a/src/fw.c
+++ b/src/fw.c
@@ -935,7 +935,17 @@ send_request(fw_handle_t handle, int tcode,
{
struct fw_cdev_send_request *request;
struct request_closure *closure;
- int i;
+ int ioctl_nr = FW_CDEV_IOC_SEND_REQUEST;
+ int fd, i;
+
+#ifdef FW_CDEV_IOC_SEND_BROADCAST_REQUEST /* added in kernel 2.6.30 */
+ if (node == 0xffff) {
+ ioctl_nr = FW_CDEV_IOC_SEND_BROADCAST_REQUEST;
+ fd = handle->ioctl_fd;
+ }
+#endif
+ if (ioctl_nr != FW_CDEV_IOC_SEND_REQUEST)
+ goto node_id_ok;
if (node > handle->reset.root_node_id) {
handle->err = -RCODE_NO_ACK;
@@ -955,6 +965,9 @@ send_request(fw_handle_t handle, int tcode,
errno = fw_errcode_to_errno(handle->err);
return -1;
}
+ fd = handle->devices[i].fd;
+
+node_id_ok:
closure = malloc(sizeof *closure);
if (closure == NULL) {
@@ -975,7 +988,7 @@ send_request(fw_handle_t handle, int tcode,
request->closure = ptr_to_u64(closure);
request->data = ptr_to_u64(in);
- return ioctl(handle->devices[i].fd, FW_CDEV_IOC_SEND_REQUEST, request);
+ return ioctl(fd, ioctl_nr, request);
}
int