summaryrefslogtreecommitdiffstats
path: root/src/main.c
diff options
context:
space:
mode:
authorGravatar aeb 2000-08-08 00:29:08 +0000
committerGravatar aeb 2000-08-08 00:29:08 +0000
commit1a91281532f25b2109b02d5560d1c4605dd20183 (patch)
tree3b162f5bcde6178074834242c6a9f02e837aa8db /src/main.c
parentAdded support for isochronous sending. (diff)
Added raw1394_get_irm_id().
git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@35 53a565d1-3bb7-0310-b661-cf11e63c67ab
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/main.c b/src/main.c
index 2e6d99f..0fe887b 100644
--- a/src/main.c
+++ b/src/main.c
@@ -56,9 +56,17 @@ static unsigned int init_rawdevice(struct raw1394_handle *h)
CLEAR_REQ(req);
req->type = RAW1394_REQ_INITIALIZE;
req->misc = RAW1394_KERNELAPI_VERSION;
+ h->protocol_version = RAW1394_KERNELAPI_VERSION;
if (write(h->fd, req, sizeof(*req)) < 0) return -1;
if (read(h->fd, req, sizeof(*req)) < 0) return -1;
+
+ if (req->error == RAW1394_ERROR_COMPAT && req->misc == 3) {
+ h->protocol_version = 3;
+ if (write(h->fd, req, sizeof(*req)) < 0) return -1;
+ if (read(h->fd, req, sizeof(*req)) < 0) return -1;
+ }
+
if (req->error) {
errno = 0;
return -1;
@@ -125,6 +133,11 @@ nodeid_t raw1394_get_local_id(struct raw1394_handle *handle)
return handle->local_id;
}
+nodeid_t raw1394_get_irm_id(struct raw1394_handle *handle)
+{
+ return handle->irm_id;
+}
+
void *raw1394_get_userdata(struct raw1394_handle *handle)
{
return handle->userdata;
@@ -193,8 +206,14 @@ int raw1394_set_port(struct raw1394_handle *handle, int port)
errno = EINVAL;
return -1;
case RAW1394_ERROR_NONE:
- handle->num_of_nodes = req->misc & 0xffff;
- handle->local_id = req->misc >> 16;
+ if (handle->protocol_version == 3) {
+ handle->num_of_nodes = req->misc & 0xffff;
+ handle->local_id = req->misc >> 16;
+ } else {
+ handle->num_of_nodes = req->misc & 0xff;
+ handle->irm_id = ((req->misc >> 8) & 0xff) | 0xffc0;
+ handle->local_id = req->misc >> 16;
+ }
return 0;
default:
errno = 0;