<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>ClearChain &#187; bus</title>
	<atom:link href="http://www.clearchain.com/blog/tags/bus/feed" rel="self" type="application/rss+xml" />
	<link>http://www.clearchain.com/blog</link>
	<description>-= Daily Happenings =-</description>
	<lastBuildDate>Wed, 05 Oct 2011 23:02:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Resetting the USB Bus under linux</title>
		<link>http://www.clearchain.com/blog/posts/resetting-the-usb-bus-under-linux</link>
		<comments>http://www.clearchain.com/blog/posts/resetting-the-usb-bus-under-linux#comments</comments>
		<pubDate>Mon, 15 Sep 2008 05:55:23 +0000</pubDate>
		<dc:creator>Benjamin Close</dc:creator>
				<category><![CDATA[UniSA]]></category>
		<category><![CDATA[bus]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[reset]]></category>
		<category><![CDATA[usb]]></category>

		<guid isPermaLink="false">http://www.clearchain.com/blog/?p=11</guid>
		<description><![CDATA[<a href="http://www.clearchain.com/blog/posts/resetting-the-usb-bus-under-linux"><img align="left" hspace="5" width="150" height="150" src="http://www.clearchain.com/blog/wp-content/plugins/thumbnail-for-excerpts/tfe_no_thumb.png" class="alignleft wp-post-image tfe" alt="" title="" /></a>Today Snappy, the little photo box we have taking photos of the new Bruce Lab, broke again. Hence I quickly came up with a way of resetting the USB device under linux based on libusb. Sadly whilst I can confirm this does reset the device gphoto2 still doesn&#8217;t like our little Canon Ixus 400 and<a href="http://www.clearchain.com/blog/posts/resetting-the-usb-bus-under-linux"> <font size=-2>[..more..]</font></a>]]></description>
			<content:encoded><![CDATA[<p>Today Snappy, the little photo box<a title="Wearable Computer Lab" href="http://wearables.unisa.edu.au"> we</a> have taking photos of the new Bruce Lab, broke again. Hence I quickly came up with a way of resetting the USB device under linux based on libusb. Sadly whilst I can confirm this does reset the device gphoto2 still doesn&#8217;t like our little Canon Ixus 400 and we still get timeouts after about 12 hours of taking photos &#8211; 1 photo every 2 minutes. Below is the hack of a program I used.</p>
<p>To compile use: gcc -o outputname resetusb.c -lusb</p>
<pre>#include &lt;stdio.h&gt;
#include &lt;usb.h&gt;

int main(void)
{
      struct usb_bus *busses;
      usb_init();
      usb_find_busses();
      usb_find_devices();
      busses = usb_get_busses();
      struct usb_bus *bus;
      int c, i, a;
      /* ... */
      for (bus = busses; bus; bus = bus-&gt;next) {
        struct usb_device *dev;
        int val;
        usb_dev_handle *junk;
        for (dev = bus-&gt;devices; dev; dev = dev-&gt;next) {
          char buf[1024];
          junk = usb_open ( dev );
          usb_get_string_simple(junk,2,buf,1023);
          if ( junk == NULL ){
            printf("Can't open %p (%s)\n", dev, buf );
          } else {
            val = usb_reset(junk);
            printf( "reset %p %d (%s)\n", dev, val, buf );
          }
          usb_close(junk);
        }
      }
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.clearchain.com/blog/posts/resetting-the-usb-bus-under-linux/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

