diff --git a/NEWS b/NEWS index eccf5d4..deca55f 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,8 @@ +Version 0.8: + +- new raw1394_reset_bus() function to reset the bus + Version 0.7: - added support for environments where the kernel runs in 64 bit mode whereas diff --git a/src/kernel-raw1394.h b/src/kernel-raw1394.h index b0d8194..e496301 100644 --- a/src/kernel-raw1394.h +++ b/src/kernel-raw1394.h @@ -21,6 +21,7 @@ #define RAW1394_REQ_ISO_LISTEN 200 #define RAW1394_REQ_FCP_LISTEN 201 +#define RAW1394_REQ_RESET_BUS 202 /* kernel to user */ #define RAW1394_REQ_BUS_RESET 10000 diff --git a/src/main.c b/src/main.c index 5a3c0f9..2e6d99f 100644 --- a/src/main.c +++ b/src/main.c @@ -201,3 +201,17 @@ int raw1394_set_port(struct raw1394_handle *handle, int port) return -1; } } + +int raw1394_reset_bus(struct raw1394_handle *handle) +{ + struct raw1394_request *req = &handle->req; + + CLEAR_REQ(req); + + req->type = RAW1394_REQ_RESET_BUS; + req->generation = handle->generation; + + if (write(handle->fd, req, sizeof(*req)) < 0) return -1; + + return 0; +} diff --git a/src/raw1394.h b/src/raw1394.h index 2e38a4b..d95217e 100644 --- a/src/raw1394.h +++ b/src/raw1394.h @@ -65,6 +65,10 @@ int raw1394_get_port_info(raw1394handle_t handle, struct raw1394_portinfo *pinf, */ int raw1394_set_port(raw1394handle_t handle, int port); +/* + * Reset the connected bus. Returns -1 for failure, 0 for success. + */ +int raw1394_reset_bus(raw1394handle_t handle); /* * Get one new message through handle and process it. See below for handler