Re: dfu-util 0.5

2012-04-21 Thread Hans Petter Selasky
On Saturday 21 April 2012 07:48:41 Matthias Apitz wrote:
> El día Friday, April 20, 2012 a las 04:18:46PM +0200, Matthias Apitz 
escribió:
> > > Hi,
> > > 
> > > You need to patch the latest git:
> > > 
> > > git clone git://git.openezx.org/dfu-util.git
> > > 
> > > And build that.
> 
> Hello,
> 
> I have spent some hours reading stuff about autoconf but do not know how
> to solve this:
> 
> $ git clone git://git.openezx.org/dfu-util.git
> $ cd dfu-util
> $ ./autogen.sh
> /usr/local/share/aclocal/smpeg.m4:13: warning: underquoted definition of
> AM_PATH_SMPEG /usr/local/share/aclocal/smpeg.m4:13:   run info
> '(automake)Extending aclocal' /usr/local/share/aclocal/smpeg.m4:13:   or
> see http://sources.redhat.com/automake/automake.html#Extending-aclocal
> configure.ac:7: required file `m4/install-sh' not found
> configure.ac:7:   `automake --add-missing' can install `install-sh'
> configure.ac:7: required file `m4/missing' not found
> configure.ac:7:   `automake --add-missing' can install `missing'
> src/Makefile.am: required file `m4/depcomp' not found
> src/Makefile.am:   `automake --add-missing' can install `depcomp'
> autoreconf-2.68: automake failed with exit status: 1
> $
> 
> This is here a system where ~1200 ports have been compiled, i.e. one
> with a full dev env and not a naked one...
> 
> Any ideas? Thanks

Maybe you can copy the patched files to the existing tarball?

--HPS
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: dfu-util 0.5

2012-04-20 Thread Matthias Apitz
El día Friday, April 20, 2012 a las 04:18:46PM +0200, Matthias Apitz escribió:

> > Hi,
> > 
> > You need to patch the latest git:
> > 
> > git clone git://git.openezx.org/dfu-util.git
> > 
> > And build that.

Hello,

I have spent some hours reading stuff about autoconf but do not know how
to solve this:

$ git clone git://git.openezx.org/dfu-util.git
$ cd dfu-util
$ ./autogen.sh 
/usr/local/share/aclocal/smpeg.m4:13: warning: underquoted definition of 
AM_PATH_SMPEG
/usr/local/share/aclocal/smpeg.m4:13:   run info '(automake)Extending aclocal'
/usr/local/share/aclocal/smpeg.m4:13:   or see 
http://sources.redhat.com/automake/automake.html#Extending-aclocal
configure.ac:7: required file `m4/install-sh' not found
configure.ac:7:   `automake --add-missing' can install `install-sh'
configure.ac:7: required file `m4/missing' not found
configure.ac:7:   `automake --add-missing' can install `missing'
src/Makefile.am: required file `m4/depcomp' not found
src/Makefile.am:   `automake --add-missing' can install `depcomp'
autoreconf-2.68: automake failed with exit status: 1 
$

This is here a system where ~1200 ports have been compiled, i.e. one
with a full dev env and not a naked one...

Any ideas? Thanks

matthias
-- 
Matthias Apitz
t +49-89-61308 351 - f +49-89-61308 399 - m +49-170-4527211
e  - w http://www.unixarea.de/
UNIX since V7 on PDP-11 | UNIX on mainframe since ESER 1055 (IBM /370)
UNIX on x86 since SVR4.2 UnixWare 2.1.2 | FreeBSD since 2.2.5
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: dfu-util 0.5

2012-04-20 Thread Matthias Apitz
El día Friday, April 20, 2012 a las 03:57:01PM +0200, Hans Petter Selasky 
escribió:

> On Tuesday 17 April 2012 22:05:43 Hans Petter Selasky wrote:
> > On Tuesday 17 April 2012 21:58:36 Hans Petter Selasky wrote:
> > > Hi Matthias,
> > > 
> > > I reviewed the dfu-util code and there is a bug there with regard to
> > > libusb usage.
> > > 
> > > Can you try the attached patch. It fixes a duplicate libusb open bug.
> > > 
> > > --HPS
> > 
> > Found a small bug. Try updated patch.
> > 
> > --HPS
> 
> 
> Hi,
> 
> You need to patch the latest git:
> 
> git clone git://git.openezx.org/dfu-util.git
> 
> And build that.

Hello Hans,

Thanks for your helping hand; the patch does its work fine based on the
sources out of git; I could not build it until now for some problems
with the tool 'autoreconf' used to create the configure script; I will
dig into this...

on the other hand it turned out the SHR devel folks do not recommend
the usage of 'dfu-util' anymore to flash the NAND memory of the
Freerunner cellphone; there is rumor that the resulting root file system
is logically corrupt; they recommend now the creation of an ext2fs on
the microSD card and just untar the distribution into it (which worked
fine and my Freerunner is now on the last stage version);

in any case, I will return to this and test your patch.

Thanks again

matthias
> 
> --HPS
> ___
> freebsd-usb@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-usb
> To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"

-- 
Matthias Apitz
e  - w http://www.unixarea.de/
UNIX since V7 on PDP-11, UNIX on mainframe since ESER 1055 (IBM /370)
UNIX on x86 since SVR4.2 UnixWare 2.1.2, FreeBSD since 2.2.5
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: dfu-util 0.5

2012-04-20 Thread Hans Petter Selasky
On Tuesday 17 April 2012 22:05:43 Hans Petter Selasky wrote:
> On Tuesday 17 April 2012 21:58:36 Hans Petter Selasky wrote:
> > Hi Matthias,
> > 
> > I reviewed the dfu-util code and there is a bug there with regard to
> > libusb usage.
> > 
> > Can you try the attached patch. It fixes a duplicate libusb open bug.
> > 
> > --HPS
> 
> Found a small bug. Try updated patch.
> 
> --HPS


Hi,

You need to patch the latest git:

git clone git://git.openezx.org/dfu-util.git

And build that.

--HPS
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: dfu-util 0.5

2012-04-18 Thread Matthias Apitz
El día Tuesday, April 17, 2012 a las 10:05:43PM +0200, Hans Petter Selasky 
escribió:

> On Tuesday 17 April 2012 21:58:36 Hans Petter Selasky wrote:
> > Hi Matthias,
> > 
> > I reviewed the dfu-util code and there is a bug there with regard to libusb
> > usage.
> > 
> > Can you try the attached patch. It fixes a duplicate libusb open bug.
> > 
> > --HPS
> 
> Found a small bug. Try updated patch.
> 
> --HPS


Hi,

Thanks, but the patch failed in two places:

$ rm -rf dfu-util-0.5
$ tar xzf dfu-util-0.5.tar.gz 
$ cd dfu-util-0.5/src
$ patch < ~/dfu-util.patch 
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--
|diff --git a/src/main.c b/src/main.c
|index 8986859..46f0e01 100644
|--- a/src/main.c
|+++ b/src/main.c
--
Patching file main.c using Plan A...
Hunk #1 succeeded at 63.
Hunk #2 failed at 76.
Hunk #3 failed at 86.
Hunk #4 succeeded at 114 (offset -4 lines).
Hunk #5 succeeded at 148 (offset -4 lines).
Hunk #6 succeeded at 168 (offset -4 lines).
Hunk #7 succeeded at 190 (offset -4 lines).
Hunk #8 succeeded at 254 (offset -1 lines).
Hunk #9 succeeded at 287 (offset -4 lines).
Hunk #10 succeeded at 931 (offset -18 lines).
2 out of 10 hunks failed--saving rejects to main.c.rej
done

was your diff against the original dfu-util-0.5.tar.gz?

Thanks

matthias

-- 
Matthias Apitz
e  - w http://www.unixarea.de/
UNIX since V7 on PDP-11, UNIX on mainframe since ESER 1055 (IBM /370)
UNIX on x86 since SVR4.2 UnixWare 2.1.2, FreeBSD since 2.2.5
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: dfu-util 0.5

2012-04-17 Thread Hans Petter Selasky
On Tuesday 17 April 2012 21:58:36 Hans Petter Selasky wrote:
> Hi Matthias,
> 
> I reviewed the dfu-util code and there is a bug there with regard to libusb
> usage.
> 
> Can you try the attached patch. It fixes a duplicate libusb open bug.
> 
> --HPS

Found a small bug. Try updated patch.

--HPS
diff --git a/src/main.c b/src/main.c
index 8986859..46f0e01 100644
--- a/src/main.c
+++ b/src/main.c
@@ -63,7 +63,7 @@ int verbose = 0;
  * Iterate through all DFU interfaces and their alternate settings
  * and call the passed handler function on each setting until handler
  * returns non-zero. */
-static int find_dfu_if(libusb_device *dev,
+static int find_dfu_if(libusb_device *dev, libusb_device_handle *devh,
 		   int (*handler)(struct dfu_if *, void *),
 		   void *v)
 {
@@ -76,6 +76,9 @@ static int find_dfu_if(libusb_device *dev,
 	int rc;
 
 	memset(dfu_if, 0, sizeof(*dfu_if));
+
+	dfu_if->dev_handle = devh;
+
 	rc = libusb_get_device_descriptor(dev, &desc);
 	if (rc)
 		return rc;
@@ -83,21 +86,21 @@ static int find_dfu_if(libusb_device *dev,
 	 cfg_idx++) {
 		rc = libusb_get_config_descriptor(dev, cfg_idx, &cfg);
 		if (rc)
-			return rc;
+			goto done;	
 		/* in some cases, noticably FreeBSD if uid != 0,
 		 * the configuration descriptors are empty */
 		if (!cfg)
-			return 0;
+			goto done;
 		for (intf_idx = 0; intf_idx < cfg->bNumInterfaces;
 		 intf_idx++) {
 			uif = &cfg->interface[intf_idx];
 			if (!uif)
-return 0;
+goto done;
 			for (alt_idx = 0;
 			 alt_idx < uif->num_altsetting; alt_idx++) {
 intf = &uif->altsetting[alt_idx];
 if (!intf)
-	return 0;
+	goto done;
 if (intf->bInterfaceClass == 0xfe &&
 intf->bInterfaceSubClass == 1) {
 	dfu_if->dev = dev;
@@ -115,17 +118,21 @@ static int find_dfu_if(libusb_device *dev,
 		dfu_if->flags |= DFU_IFF_DFU;
 	else
 		dfu_if->flags &= ~DFU_IFF_DFU;
-	if (!handler)
-		return 1;
+	if (!handler) {
+		rc = 1;
+		goto done;
+	}
 	rc = handler(dfu_if, v);
 	if (rc != 0)
-		return rc;
+		goto done;
 }
 			}
 		}
-
 		libusb_free_config_descriptor(cfg);
 	}
+done:
+	if (devh == NULL && dfu_if->dev_handle != NULL)
+		libusb_close(dfu_if->dev_handle);
 
 	return 0;
 }
@@ -145,7 +152,8 @@ static int _get_first_cb(struct dfu_if *dif, void *v)
 /* Fills in dif with the first found DFU interface */
 static int get_first_dfu_if(struct dfu_if *dif)
 {
-	return find_dfu_if(dif->dev, &_get_first_cb, (void *) dif);
+	return find_dfu_if(dif->dev, dif->dev_handle,
+	&_get_first_cb, (void *) dif);
 }
 
 static int _check_match_cb(struct dfu_if *dif, void *v)
@@ -164,7 +172,8 @@ static int _check_match_cb(struct dfu_if *dif, void *v)
 /* Fills in dif from the matching DFU interface/altsetting */
 static int get_matching_dfu_if(struct dfu_if *dif)
 {
-	return find_dfu_if(dif->dev, &_check_match_cb, (void *) dif);
+	return find_dfu_if(dif->dev, dif->dev_handle,
+	&_check_match_cb, (void *) dif);
 }
 
 static int _count_match_cb(struct dfu_if *dif, void *v)
@@ -185,7 +194,8 @@ static int _count_match_cb(struct dfu_if *dif, void *v)
 static int count_matching_dfu_if(struct dfu_if *dif)
 {
 	dif->count = 0;
-	find_dfu_if(dif->dev, &_count_match_cb, (void *) dif);
+	find_dfu_if(dif->dev, dif->dev_handle,
+	&_count_match_cb, (void *) dif);
 	return dif->count;
 }
 
@@ -245,7 +255,7 @@ static int list_dfu_interfaces(libusb_context *ctx)
 
 	for (i = 0; i < num_devs; ++i) {
 		dev = list[i];
-		find_dfu_if(dev, &print_dfu_if, NULL);
+		find_dfu_if(dev, NULL, &print_dfu_if, NULL);
 	}
 
 	libusb_free_device_list(list, 1);
@@ -281,7 +291,7 @@ static int count_dfu_interfaces(libusb_device *dev)
 {
 	int num_found = 0;
 
-	find_dfu_if(dev, &_count_cb, (void *) &num_found);
+	find_dfu_if(dev, NULL, &_count_cb, (void *) &num_found);
 
 	return num_found;
 }
@@ -939,7 +949,8 @@ dfustate:
 	if (alt_name) {
 		int n;
 
-		n = find_dfu_if(dif->dev, &alt_by_name, alt_name);
+		n = find_dfu_if(dif->dev, dif->dev_handle,
+		&alt_by_name, alt_name);
 		if (!n) {
 			fprintf(stderr, "No such Alternate Setting: \"%s\"\n",
 			alt_name);
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: dfu-util 0.5

2012-04-17 Thread Hans Petter Selasky
Hi Matthias,

I reviewed the dfu-util code and there is a bug there with regard to libusb 
usage.

Can you try the attached patch. It fixes a duplicate libusb open bug.

--HPS
diff --git a/src/main.c b/src/main.c
index 8986859..11ddf4f 100644
--- a/src/main.c
+++ b/src/main.c
@@ -63,7 +63,7 @@ int verbose = 0;
  * Iterate through all DFU interfaces and their alternate settings
  * and call the passed handler function on each setting until handler
  * returns non-zero. */
-static int find_dfu_if(libusb_device *dev,
+static int find_dfu_if(libusb_device *dev, libusb_device_handle *devh,
 		   int (*handler)(struct dfu_if *, void *),
 		   void *v)
 {
@@ -83,24 +83,25 @@ static int find_dfu_if(libusb_device *dev,
 	 cfg_idx++) {
 		rc = libusb_get_config_descriptor(dev, cfg_idx, &cfg);
 		if (rc)
-			return rc;
+			goto done;	
 		/* in some cases, noticably FreeBSD if uid != 0,
 		 * the configuration descriptors are empty */
 		if (!cfg)
-			return 0;
+			goto done;
 		for (intf_idx = 0; intf_idx < cfg->bNumInterfaces;
 		 intf_idx++) {
 			uif = &cfg->interface[intf_idx];
 			if (!uif)
-return 0;
+goto done;
 			for (alt_idx = 0;
 			 alt_idx < uif->num_altsetting; alt_idx++) {
 intf = &uif->altsetting[alt_idx];
 if (!intf)
-	return 0;
+	goto done;
 if (intf->bInterfaceClass == 0xfe &&
 intf->bInterfaceSubClass == 1) {
 	dfu_if->dev = dev;
+	dfu_if->dev_handle = devh;
 	dfu_if->vendor =
 		desc.idVendor;
 	dfu_if->product =
@@ -115,17 +116,21 @@ static int find_dfu_if(libusb_device *dev,
 		dfu_if->flags |= DFU_IFF_DFU;
 	else
 		dfu_if->flags &= ~DFU_IFF_DFU;
-	if (!handler)
-		return 1;
+	if (!handler) {
+		rc = 1;
+		goto done;
+	}
 	rc = handler(dfu_if, v);
 	if (rc != 0)
-		return rc;
+		goto done;
 }
 			}
 		}
-
 		libusb_free_config_descriptor(cfg);
 	}
+done:
+	if (devh == NULL && dfu_if->dev_handle != NULL)
+		libusb_close(dfu_if->dev_handle);
 
 	return 0;
 }
@@ -145,7 +150,8 @@ static int _get_first_cb(struct dfu_if *dif, void *v)
 /* Fills in dif with the first found DFU interface */
 static int get_first_dfu_if(struct dfu_if *dif)
 {
-	return find_dfu_if(dif->dev, &_get_first_cb, (void *) dif);
+	return find_dfu_if(dif->dev, dif->dev_handle,
+	&_get_first_cb, (void *) dif);
 }
 
 static int _check_match_cb(struct dfu_if *dif, void *v)
@@ -164,7 +170,8 @@ static int _check_match_cb(struct dfu_if *dif, void *v)
 /* Fills in dif from the matching DFU interface/altsetting */
 static int get_matching_dfu_if(struct dfu_if *dif)
 {
-	return find_dfu_if(dif->dev, &_check_match_cb, (void *) dif);
+	return find_dfu_if(dif->dev, dif->dev_handle,
+	&_check_match_cb, (void *) dif);
 }
 
 static int _count_match_cb(struct dfu_if *dif, void *v)
@@ -185,7 +192,8 @@ static int _count_match_cb(struct dfu_if *dif, void *v)
 static int count_matching_dfu_if(struct dfu_if *dif)
 {
 	dif->count = 0;
-	find_dfu_if(dif->dev, &_count_match_cb, (void *) dif);
+	find_dfu_if(dif->dev, dif->dev_handle,
+	&_count_match_cb, (void *) dif);
 	return dif->count;
 }
 
@@ -245,7 +253,7 @@ static int list_dfu_interfaces(libusb_context *ctx)
 
 	for (i = 0; i < num_devs; ++i) {
 		dev = list[i];
-		find_dfu_if(dev, &print_dfu_if, NULL);
+		find_dfu_if(dev, NULL, &print_dfu_if, NULL);
 	}
 
 	libusb_free_device_list(list, 1);
@@ -281,7 +289,7 @@ static int count_dfu_interfaces(libusb_device *dev)
 {
 	int num_found = 0;
 
-	find_dfu_if(dev, &_count_cb, (void *) &num_found);
+	find_dfu_if(dev, NULL, &_count_cb, (void *) &num_found);
 
 	return num_found;
 }
@@ -939,7 +947,8 @@ dfustate:
 	if (alt_name) {
 		int n;
 
-		n = find_dfu_if(dif->dev, &alt_by_name, alt_name);
+		n = find_dfu_if(dif->dev, dif->dev_handle,
+		&alt_by_name, alt_name);
 		if (!n) {
 			fprintf(stderr, "No such Alternate Setting: \"%s\"\n",
 			alt_name);
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: dfu-util 0.5

2012-04-17 Thread Matthias Apitz
El día Tuesday, April 17, 2012 a las 08:41:56PM +0200, Hans Petter Selasky 
escribió:

> > Claiming USB DFU Runtime Interface...
> > Determining device status: state = appIDLE, status = 0
> > Device really in Runtime Mode, send DFU detach request...
> > Resetting USB...
> > libusb_set_configuration(_rt_dif.dev_handle, 1)
> > _rt_dif.dev_handle 28449d80
> > Opening USB Device...
> > No such Alternate Setting: "rootfs"
> 
> What does usbconfig say about your device after this procedure?

after such flash attempt it says


ugen0.1:  at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) 
pwr=SAVE


 Configuration index 0

bLength = 0x0009 
bDescriptorType = 0x0002 
wTotalLength = 0x0019 
bNumInterfaces = 0x0001 
bConfigurationValue = 0x0001 
iConfiguration = 0x  
bmAttributes = 0x0040 
bMaxPower = 0x 

Interface 0
  bLength = 0x0009 
  bDescriptorType = 0x0004 
  bInterfaceNumber = 0x 
  bAlternateSetting = 0x 
  bNumEndpoints = 0x0001 
  bInterfaceClass = 0x0009 
  bInterfaceSubClass = 0x 
  bInterfaceProtocol = 0x 
  iInterface = 0x  

 Endpoint 0
bLength = 0x0007 
bDescriptorType = 0x0005 
bEndpointAddress = 0x0081  
bmAttributes = 0x0003  
wMaxPacketSize = 0x0008 
bInterval = 0x00ff 
bRefresh = 0x 
bSynchAddress = 0x 



ugen1.1:  at usbus1, cfg=0 md=HOST spd=FULL (12Mbps) 
pwr=SAVE


 Configuration index 0

bLength = 0x0009 
bDescriptorType = 0x0002 
wTotalLength = 0x0019 
bNumInterfaces = 0x0001 
bConfigurationValue = 0x0001 
iConfiguration = 0x  
bmAttributes = 0x0040 
bMaxPower = 0x 

Interface 0
  bLength = 0x0009 
  bDescriptorType = 0x0004 
  bInterfaceNumber = 0x 
  bAlternateSetting = 0x 
  bNumEndpoints = 0x0001 
  bInterfaceClass = 0x0009 
  bInterfaceSubClass = 0x 
  bInterfaceProtocol = 0x 
  iInterface = 0x  

 Endpoint 0
bLength = 0x0007 
bDescriptorType = 0x0005 
bEndpointAddress = 0x0081  
bmAttributes = 0x0003  
wMaxPacketSize = 0x0008 
bInterval = 0x00ff 
bRefresh = 0x 
bSynchAddress = 0x 



ugen2.1:  at usbus2, cfg=0 md=HOST spd=FULL (12Mbps) 
pwr=SAVE


 Configuration index 0

bLength = 0x0009 
bDescriptorType = 0x0002 
wTotalLength = 0x0019 
bNumInterfaces = 0x0001 
bConfigurationValue = 0x0001 
iConfiguration = 0x  
bmAttributes = 0x0040 
bMaxPower = 0x 

Interface 0
  bLength = 0x0009 
  bDescriptorType = 0x0004 
  bInterfaceNumber = 0x 
  bAlternateSetting = 0x 
  bNumEndpoints = 0x0001 
  bInterfaceClass = 0x0009 
  bInterfaceSubClass = 0x 
  bInterfaceProtocol = 0x 
  iInterface = 0x  

 Endpoint 0
bLength = 0x0007 
bDescriptorType = 0x0005 
bEndpointAddress = 0x0081  
bmAttributes = 0x0003  
wMaxPacketSize = 0x0008 
bInterval = 0x00ff 
bRefresh = 0x 
bSynchAddress = 0x 



ugen3.1:  at usbus3, cfg=0 md=HOST spd=FULL (12Mbps) 
pwr=SAVE


 Configuration index 0

bLength = 0x0009 
bDescriptorType = 0x0002 
wTotalLength = 0x0019 
bNumInterfaces = 0x0001 
bConfigurationValue = 0x0001 
iConfiguration = 0x  
bmAttributes = 0x0040 
bMaxPower = 0x 

Interface 0
  bLength = 0x0009 
  bDescriptorType = 0x0004 
  bInterfaceNumber = 0x 
  bAlternateSetting = 0x 
  bNumEndpoints = 0x0001 
  bInterfaceClass = 0x0009 
  bInterfaceSubClass = 0x 
  bInterfaceProtocol = 0x 
  iInterface = 0x  

 Endpoint 0
bLength = 0x0007 
bDescriptorType = 0x0005 
bEndpointAddress = 0x0081  
bmAttributes = 0x0003  
wMaxPacketSize = 0x0008 
bInterval = 0x00ff 
bRefresh = 0x 
bSynchAddress = 0x 



ugen4.1:  at usbus4, cfg=0 md=HOST spd=HIGH (480Mbps) 
pwr=SAVE


 Configuration index 0

bLength = 0x0009 
bDescriptorType = 0x0002 
wTotalLength = 0x0019 
bNumInterfaces = 0x0001 
bConfigurationValue = 0x0001 
iConfiguration = 0x  
bmAttributes = 0x0040 
bMaxPower = 0x 

Interface 0
  bLength = 0x0009 
  bDescriptorType = 0x0004 
  bInterfaceNumber = 0x 
  bAlternateSetting = 0x 
  bNumEndpoints = 0x0001 
  bInterfaceClass = 0x0009 
  bInterfaceSubClass = 0x 
  bInterfaceProtocol = 0x 
  iInterface = 0x  

 Endpoint 0
bLength = 0x0007 
bDescriptorType = 0x0005 
bEndpointAddress = 0x0081  
bmAttributes = 0x0003  
wMaxPacketSize = 0x0008 
bInterval = 0x00ff 
bRefresh = 0x 
bSynchAddress = 0x 



ugen4.2:  at usbus4, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON


 Configur

Re: dfu-util 0.5

2012-04-17 Thread Hans Petter Selasky
On Tuesday 17 April 2012 20:29:38 Matthias Apitz wrote:
> El día Tuesday, April 17, 2012 a las 07:59:02PM +0200, Hans Petter Selasky 
escribió:
> > > Resetting USB...
> > > doing libusb_set_configuration(dif->dev_handle, 1)
> > > dif->dev_handle 28449f00
> > > Opening USB Device...
> > > No such Alternate Setting: "rootfs"
> > 
> > You should use the same handle like for libusb_reset_device();
> 
> same result:
> 
> Opening DFU USB device... ID 1d50:5119
> Run-time device DFU version 0100
> Claiming USB DFU Runtime Interface...
> Determining device status: state = appIDLE, status = 0
> Device really in Runtime Mode, send DFU detach request...
> Resetting USB...
> libusb_set_configuration(_rt_dif.dev_handle, 1)
> _rt_dif.dev_handle 28449d80
> Opening USB Device...
> No such Alternate Setting: "rootfs"

What does usbconfig say about your device after this procedure?

--HPS
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: dfu-util 0.5

2012-04-17 Thread Matthias Apitz
El día Tuesday, April 17, 2012 a las 07:59:02PM +0200, Hans Petter Selasky 
escribió:

> > Resetting USB...
> > doing libusb_set_configuration(dif->dev_handle, 1)
> > dif->dev_handle 28449f00
> > Opening USB Device...
> > No such Alternate Setting: "rootfs"
> > 
> 
> You should use the same handle like for libusb_reset_device();

same result:

Opening DFU USB device... ID 1d50:5119
Run-time device DFU version 0100
Claiming USB DFU Runtime Interface...
Determining device status: state = appIDLE, status = 0
Device really in Runtime Mode, send DFU detach request...
Resetting USB...
libusb_set_configuration(_rt_dif.dev_handle, 1)
_rt_dif.dev_handle 28449d80
Opening USB Device...
No such Alternate Setting: "rootfs"

Thanks

matthias
-- 
Matthias Apitz
e  - w http://www.unixarea.de/
UNIX since V7 on PDP-11, UNIX on mainframe since ESER 1055 (IBM /370)
UNIX on x86 since SVR4.2 UnixWare 2.1.2, FreeBSD since 2.2.5
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: dfu-util 0.5

2012-04-17 Thread Hans Petter Selasky
On Tuesday 17 April 2012 17:48:39 Matthias Apitz wrote:
> El día Tuesday, April 17, 2012 a las 05:36:56PM +0200, Hans Petter Selasky 
escribió:
> > Could you check if the libusb handle gets closed after reset?
> 
> The code part lookslike this:
> 
> printf("Resetting USB...\n");
> ret =
> libusb_reset_device(_rt_dif.dev_handle); if (ret < 0 && ret !=
> LIBUSB_ERROR_NOT_FOUND) fprintf(stderr, "error resetting "
> "after detach\n");
> fprintf(stderr, "doing
> libusb_set_configuration(dif->dev_handle, 1)\n");
> libusb_set_configuration(dif->dev_handle,
> 1);
> sleep(2);
> fprintf(stderr, "dif->dev_handle %08x\n",
> dif->dev_handle);
> 
> for reset it uses _rt_dif.dev_handle, and you made me add an operation
> with dif->dev_handle, is this correct?
> 
> anyway:
> 
> Resetting USB...
> doing libusb_set_configuration(dif->dev_handle, 1)
> dif->dev_handle 28449f00
> Opening USB Device...
> No such Alternate Setting: "rootfs"
> 

You should use the same handle like for libusb_reset_device();

--HPS
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: dfu-util 0.5

2012-04-17 Thread Matthias Apitz
El día Tuesday, April 17, 2012 a las 05:36:56PM +0200, Hans Petter Selasky 
escribió:

> 
> Could you check if the libusb handle gets closed after reset?

The code part lookslike this:

printf("Resetting USB...\n");
ret = libusb_reset_device(_rt_dif.dev_handle);
if (ret < 0 && ret != LIBUSB_ERROR_NOT_FOUND)
fprintf(stderr, "error resetting
"
"after detach\n");
fprintf(stderr, "doing
libusb_set_configuration(dif->dev_handle, 1)\n");
libusb_set_configuration(dif->dev_handle,
1);
sleep(2);
fprintf(stderr, "dif->dev_handle %08x\n", 
dif->dev_handle);

for reset it uses _rt_dif.dev_handle, and you made me add an operation
with dif->dev_handle, is this correct?

anyway:

Resetting USB...
doing libusb_set_configuration(dif->dev_handle, 1)
dif->dev_handle 28449f00
Opening USB Device...
No such Alternate Setting: "rootfs"

Thanks

matthias

-- 
Matthias Apitz
e  - w http://www.unixarea.de/
UNIX since V7 on PDP-11, UNIX on mainframe since ESER 1055 (IBM /370)
UNIX on x86 since SVR4.2 UnixWare 2.1.2, FreeBSD since 2.2.5
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: dfu-util 0.5

2012-04-17 Thread Hans Petter Selasky
On Tuesday 17 April 2012 17:18:01 Matthias Apitz wrote:
> El día Tuesday, April 17, 2012 a las 04:53:24PM +0200, Hans Petter Selasky 
escribió:
> > After:
> > 
> > <   ret = libusb_reset_device(dif->dev_handle);
> > 
> > Try to add:
> > 
> > libusb_set_configuration(dif->dev_handle, 1);
> 
> Hi,
> 
> Your code gets executed, I even added a sleep(2) after it, but the
> problem remains:
> 
> ...
> Resetting USB...
> doing libusb_set_configuration(dif->dev_handle, 1)
> Opening USB Device...
> No such Alternate Setting: "rootfs"
> 

Could you check if the libusb handle gets closed after reset?

--HPS
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: dfu-util 0.5

2012-04-17 Thread Matthias Apitz
El día Tuesday, April 17, 2012 a las 04:53:24PM +0200, Hans Petter Selasky 
escribió:

> After:
> 
> <   ret = libusb_reset_device(dif->dev_handle);
> 
> Try to add:
> 
> libusb_set_configuration(dif->dev_handle, 1);

Hi,

Your code gets executed, I even added a sleep(2) after it, but the
problem remains:

...
Resetting USB...
doing libusb_set_configuration(dif->dev_handle, 1)
Opening USB Device...
No such Alternate Setting: "rootfs"

Thanks

matthias
-- 
Matthias Apitz
e  - w http://www.unixarea.de/
UNIX since V7 on PDP-11, UNIX on mainframe since ESER 1055 (IBM /370)
UNIX on x86 since SVR4.2 UnixWare 2.1.2, FreeBSD since 2.2.5
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: dfu-util 0.5

2012-04-17 Thread Hans Petter Selasky
On Tuesday 17 April 2012 16:07:39 Matthias Apitz wrote:
> El día Tuesday, April 17, 2012 a las 03:40:24PM +0200, Hans Petter Selasky 
escribió:
> > > > > > Latest version is 0.5 see
> > > > > > http://dfu-util.gnumonks.org/
> > > > > 
> > > > > this is not ported to FreeBSD; I will try to get it updated or port
> > > > > it by my onw;
> > > 
> > > I have compiled dfu-util 0.5 directly from the sources because the port
> > > is version 0.1 from 2009; this went streight forward with:
> > > 
> > > $ USB_CFLAGS=" " USB_LIBS="-lusb" ./configure
> > > $ make
> > > 
> > > but the resulting dfu-util somehow does not work (while the 0.1 version
> > > works fine on the same FreeBSD host and the same Freerunner):
> > > 
> > > # ~/dfu-util-0.5/src/dfu-util -d 0x1d50:0x5119 -a rootfs -R -D
> > > shr-image-om-gta02-20120413222611.rootfs.jffs2 dfu-util 0.5
> > 
> > Could you provide a source-code diff?
> 
> attached; thanks
> 

Hi,


After:

<   ret = libusb_reset_device(dif->dev_handle);

Try to add:

libusb_set_configuration(dif->dev_handle, 1);

--HPS
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: dfu-util 0.5

2012-04-17 Thread Matthias Apitz
El día Tuesday, April 17, 2012 a las 03:40:24PM +0200, Hans Petter Selasky 
escribió:

> > > > > Latest version is 0.5 see
> > > > > http://dfu-util.gnumonks.org/
> > > > 
> > > > this is not ported to FreeBSD; I will try to get it updated or port it
> > > > by my onw;
> > 
> > I have compiled dfu-util 0.5 directly from the sources because the port
> > is version 0.1 from 2009; this went streight forward with:
> > 
> > $ USB_CFLAGS=" " USB_LIBS="-lusb" ./configure
> > $ make
> > 
> > but the resulting dfu-util somehow does not work (while the 0.1 version
> > works fine on the same FreeBSD host and the same Freerunner):
> > 
> > # ~/dfu-util-0.5/src/dfu-util -d 0x1d50:0x5119 -a rootfs -R -D
> > shr-image-om-gta02-20120413222611.rootfs.jffs2 dfu-util 0.5
> 
> Could you provide a source-code diff?

attached; thanks

matthias
-- 
Matthias Apitz
e  - w http://www.unixarea.de/
UNIX since V7 on PDP-11, UNIX on mainframe since ESER 1055 (IBM /370)
UNIX on x86 since SVR4.2 UnixWare 2.1.2, FreeBSD since 2.2.5
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: dfu-util 0.5

2012-04-17 Thread Hans Petter Selasky
On Tuesday 17 April 2012 12:01:48 Matthias Apitz wrote:
> Hello,
> 
> > > > > 'dfu-util' from FreeBSD:
> > > > > 
> > > > > $ dfu-util -V
> > > > > dfu-util - (C) 2007-2008 by OpenMoko Inc.
> > > > > This program is Free Software and has ABSOLUTELY NO WARRANTY
> > > > > dfu-util version 0.1+svnUnversioned directory
> > > > 
> > > > Latest version is 0.5 see
> > > > http://dfu-util.gnumonks.org/
> > > 
> > > this is not ported to FreeBSD; I will try to get it updated or port it
> > > by my onw;
> 
> I have compiled dfu-util 0.5 directly from the sources because the port
> is version 0.1 from 2009; this went streight forward with:
> 
> $ USB_CFLAGS=" " USB_LIBS="-lusb" ./configure
> $ make
> 
> but the resulting dfu-util somehow does not work (while the 0.1 version
> works fine on the same FreeBSD host and the same Freerunner):
> 
> # ~/dfu-util-0.5/src/dfu-util -d 0x1d50:0x5119 -a rootfs -R -D
> shr-image-om-gta02-20120413222611.rootfs.jffs2 dfu-util 0.5

Could you provide a source-code diff?

--HPS
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


dfu-util 0.5

2012-04-17 Thread Matthias Apitz

Hello,

> > > > 'dfu-util' from FreeBSD:
> > > > 
> > > > $ dfu-util -V
> > > > dfu-util - (C) 2007-2008 by OpenMoko Inc.
> > > > This program is Free Software and has ABSOLUTELY NO WARRANTY
> > > > dfu-util version 0.1+svnUnversioned directory
> > > 
> > > Latest version is 0.5 see
> > > http://dfu-util.gnumonks.org/
> > 
> > this is not ported to FreeBSD; I will try to get it updated or port it
> > by my onw;
> 

I have compiled dfu-util 0.5 directly from the sources because the port
is version 0.1 from 2009; this went streight forward with:

$ USB_CFLAGS=" " USB_LIBS="-lusb" ./configure
$ make

but the resulting dfu-util somehow does not work (while the 0.1 version
works fine on the same FreeBSD host and the same Freerunner):

# ~/dfu-util-0.5/src/dfu-util -d 0x1d50:0x5119 -a rootfs -R -D 
shr-image-om-gta02-20120413222611.rootfs.jffs2
dfu-util 0.5

(C) 2005-2008 by Weston Schmidt, Harald Welte and OpenMoko Inc.
(C) 2010-2011 Tormod Volden (DfuSe support)
This program is Free Software and has ABSOLUTELY NO WARRANTY

dfu-util does currently only support DFU version 1.0

Filter on vendor = 0x1d50 product = 0x5119
Opening DFU USB device... ID 1d50:5119
Run-time device DFU version 0100
Claiming USB DFU Runtime Interface...
Determining device status: state = appIDLE, status = 0
Device really in Runtime Mode, send DFU detach request...
Resetting USB...
Opening USB Device...
No such Alternate Setting: "rootfs"
#

as well using "6" for "rootfs" does not work...

Any comments or hints what the problem of 0.5 with FreeBSD libusb could
be? Thanks

matthias
-- 
Matthias Apitz
e  - w http://www.unixarea.de/
UNIX since V7 on PDP-11, UNIX on mainframe since ESER 1055 (IBM /370)
UNIX on x86 since SVR4.2 UnixWare 2.1.2, FreeBSD since 2.2.5
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"