summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar dmaas 2003-03-26 22:48:46 +0000
committerGravatar dmaas 2003-03-26 22:48:46 +0000
commit081780c175c6fbcd706ebf37275ae698f3f5b3e9 (patch)
tree319523d71de31c6e09fbaa88b29269a478d3391e
parentUpdates for new rawiso ioctl interface. (diff)
add raw1394_new_handle_on_port() convenience function
git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@104 53a565d1-3bb7-0310-b661-cf11e63c67ab
-rw-r--r--src/main.c32
-rw-r--r--src/raw1394.h10
2 files changed, 41 insertions, 1 deletions
diff --git a/src/main.c b/src/main.c
index 452d92f..018943d 100644
--- a/src/main.c
+++ b/src/main.c
@@ -394,6 +394,38 @@ int raw1394_set_port(struct raw1394_handle *handle, int port)
}
}
+/**
+ * raw1394_new_handle_on_port - create a new handle and bind it to a port
+ * @port: port to connect to (same as argument to raw1394_set_port())
+ *
+ * Same as raw1394_new_handle(), but also binds the handle to the
+ * specified 1394 port. Equivalent to raw1394_new_handle() followed by
+ * raw1394_get_port_info() and raw1394_set_port(). Useful for
+ * command-line programs that already know what port they want. If
+ * raw1394_set_port() returns ESTALE, retries automatically.
+ **/
+raw1394handle_t raw1394_new_handle_on_port(int port)
+{
+ raw1394handle_t handle = raw1394_new_handle();
+ if (!handle)
+ return NULL;
+
+tryagain:
+ if (raw1394_get_port_info(handle, NULL, 0) < 0)
+ return NULL;
+
+ if (raw1394_set_port(handle, port)) {
+ if (errno == ESTALE || errno == EINTR) {
+ goto tryagain;
+ } else {
+ raw1394_destroy_handle(handle);
+ return NULL;
+ }
+ }
+
+ return handle;
+}
+
int raw1394_reset_bus_new(struct raw1394_handle *handle, int type)
{
struct raw1394_request *req = &handle->req;
diff --git a/src/raw1394.h b/src/raw1394.h
index 15401d2..38ddede 100644
--- a/src/raw1394.h
+++ b/src/raw1394.h
@@ -157,11 +157,19 @@ raw1394handle_t raw1394_new_handle(void);
void raw1394_destroy_handle(raw1394handle_t handle);
/*
+ * Same as raw1394_new_handle(), but also binds the handle to the
+ * specified 1394 port. Equivalent to raw1394_new_handle() followed by
+ * raw1394_get_port_info() and raw1394_set_port(). Useful for
+ * command-line programs that already know what port they want.
+ */
+raw1394handle_t raw1394_new_handle_on_port(int port);
+
+/*
* Switch off/on busreset-notification for handle
* return-value:
* ==0 success
* !=0 failure
- * off_on_switch .... RAW1394_NOTIFY_OFF or RAW1394_NOTIFY_ON
+ * off_on_switch .... RAW1394_NOTIFY_OFF or RAW1394_NOTIFY_ON
*/
int raw1394_busreset_notify (raw1394handle_t handle, int off_on_switch);
lass='logmsg'> like it is supposed to. git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@117 53a565d1-3bb7-0310-b661-cf11e63c67ab 2003-07-13Generate and install the pdf in the Debian package.Gravatar bencollins 3-3/+4 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@114 53a565d1-3bb7-0310-b661-cf11e63c67ab 2003-07-13Don't run configure at the end of autogen.sh. Also, remove autom4te.cache.Gravatar bencollins 1-1/+1 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@113 53a565d1-3bb7-0310-b661-cf11e63c67ab 2003-07-13Update Debian maintainerGravatar bencollins 1-1/+2 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@112 53a565d1-3bb7-0310-b661-cf11e63c67ab 2003-07-13Update Debian changelog.Gravatar bencollins 1-0/+8 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@111 53a565d1-3bb7-0310-b661-cf11e63c67ab 2003-07-13File doesn't really seem needed. The NEWS file gives a good overview, andGravatar bencollins 1-4/+0 the svn log is more than verbose enough for info seekers. git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@110 53a565d1-3bb7-0310-b661-cf11e63c67ab 2003-07-13Fix compiler warnings.Gravatar bencollins 4-12/+22 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@109 53a565d1-3bb7-0310-b661-cf11e63c67ab 2003-07-13Updates from 0.10.0 release.Gravatar bencollins 4-5/+14 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@108 53a565d1-3bb7-0310-b661-cf11e63c67ab 2003-04-23add libtoolize to bootstrapGravatar ddennedy 1-1/+10 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@107 53a565d1-3bb7-0310-b661-cf11e63c67ab 2003-04-21added Dan Maas' rawiso docsGravatar ddennedy 1-32/+295 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@106 53a565d1-3bb7-0310-b661-cf11e63c67ab 2003-04-07new_handle_on_port() error path fix from Jim RadfordGravatar dmaas 1-1/+3 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@105 53a565d1-3bb7-0310-b661-cf11e63c67ab 2003-03-26add raw1394_new_handle_on_port() convenience functionGravatar dmaas 2-1/+41 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@104 53a565d1-3bb7-0310-b661-cf11e63c67ab 2003-02-22Updates for new rawiso ioctl interface.Gravatar bencollins 3-37/+125 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@103 53a565d1-3bb7-0310-b661-cf11e63c67ab 2003-01-15add iso_xmit_sync() and iso_xmit_write(); clean up iso handling a bitGravatar dmaas 5-39/+161 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@102 53a565d1-3bb7-0310-b661-cf11e63c67ab 2003-01-15implement tag matching for rawiso receptionGravatar dmaas 3-4/+12 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@101 53a565d1-3bb7-0310-b661-cf11e63c67ab 2003-01-06back out previous commit - don't drop the legacy API just yetGravatar dmaas 6-173/+130 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@100 53a565d1-3bb7-0310-b661-cf11e63c67ab 2003-01-05emulate legacy ISO reception API on top of new rawiso APIGravatar dmaas 7-131/+174 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@99 53a565d1-3bb7-0310-b661-cf11e63c67ab 2002-12-24update iso API for multi-channel reception and new packet buffer layoutGravatar dmaas 4-123/+236 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@98 53a565d1-3bb7-0310-b661-cf11e63c67ab 2002-12-20oops, irq_interval needs to be signedGravatar anonymous 1-1/+1 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@97 53a565d1-3bb7-0310-b661-cf11e63c67ab 2002-12-20dmaas - renamed exported arm definitions into the raw1394_ namespace; ↵Gravatar anonymous 3-124/+48 brought kernel-raw1394.h back in sync with the kernel version git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@96 53a565d1-3bb7-0310-b661-cf11e63c67ab 2002-12-16rawiso updates:Gravatar dmaas 3-18/+25 - changed return type of rawiso xmit/recv handlers from int to enum raw1394_iso_disposition - added an ioctl (RAW1394_ISO_QUEUE_ACTIVITY) to force an ISO_ACTIVITY event into the queue. This is needed for handling RAW1394_ISO_DEFER, to kick us out of the next read() instead of sleeping forever. - removed references to "8-byte" isochronous header - this is an OHCI-specific implementation detail git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@95 53a565d1-3bb7-0310-b661-cf11e63c67ab 2002-11-18fix cplusplus extern C blockGravatar ddennedy 1-4/+4 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@94 53a565d1-3bb7-0310-b661-cf11e63c67ab 2002-11-18merged rawiso branchGravatar ddennedy 7-6/+488 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@93 53a565d1-3bb7-0310-b661-cf11e63c67ab