linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oliver Hartkopp <socketcan@hartkopp.net>
To: Bernd Krumboeck <krumboeck@universalnet.at>
Cc: Gediminas Simanskis <gediminas@8devices.com>, linux-can@vger.kernel.org
Subject: Re: usb_8dev: firmware and windows library
Date: Fri, 30 Jan 2015 22:56:25 +0100	[thread overview]
Message-ID: <54CBFE09.9000700@hartkopp.net> (raw)
In-Reply-To: <52E36208.3020100@universalnet.at>

[-- Attachment #1: Type: text/plain, Size: 1602 bytes --]

Hi Bernd,

I had an adapter with a firmware < v1.5 here and tried to follow the 
documentation at

https://github.com/krumboeck/usb2can_firmware#flash-the-device-linux-experimental

Unfortunately the referenced patch at
http://lists.gnumonks.org/pipermail/dfu-util/attachments/20140124/1abbc049/attachment.bin
disappeared ...

I had this patch somewhere on my former laptop and attached it for the records.

As dfu-util moved to to gitorious I cloned the dfu-util master into

https://gitorious.org/dfu-util/8devices-usb2can-dfu-util

an applied the two patches so that this version is able to flash the 8devices 
USB2CAN adapter again.

Regards,
Oliver

On 25.01.2014 08:04, Bernd Krumboeck wrote:
> Hi!
>
>
> Source code from firmware v1.5: https://github.com/krumboeck/usb2can_firmware
>
>
> After some experiments I was able to flash the firmware with dfu-util under
> linux:
> https://github.com/krumboeck/usb2can_firmware#flash-the-device-linux-experimental
>
>
> Sadly I don't know the way how to build the firmware with a free tools chain.
>
>
> regards,
> Bernd
>
>
> Am 2014-01-22 15:46, schrieb Marc Kleine-Budde:
>> On 01/22/2014 01:58 PM, Bernd Krumboeck wrote:
>>> May I kindly ask you to send me a diff/patch about the changes, so I can
>>> update the firmware sources on github.
>>
>> A complete new set of sources will do, too. Git will create the diff for
>> you. :)
>>
>> Marc
>>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-can" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

[-- Attachment #2: dfu.patch --]
[-- Type: text/x-patch, Size: 2249 bytes --]

diff --git a/src/dfuse.c b/src/dfuse.c
index 1ee6575..77648c2 100644
--- a/src/dfuse.c
+++ b/src/dfuse.c
@@ -248,6 +248,9 @@ int dfuse_special_command(struct dfu_if *dif, unsigned int address,
 	}
 	milli_sleep(dst.bwPollTimeout);
 
+	if (command == SET_ADDRESS)
+		return ret;
+
 	ret = dfu_abort(dif->dev_handle, dif->interface);
 	if (ret < 0) {
 		errx(EX_IOERR, "Error sending dfu abort request");
@@ -401,11 +404,18 @@ int dfuse_dnload_element(struct dfu_if *dif, unsigned int dwElementAddress,
 			dwElementAddress + dwElementSize - 1);
 	}
 
+	for (p = 0; p < (int)dwElementSize;) {
+		unsigned int address = dwElementAddress + p;
+		segment = find_segment(mem_layout, address);
+		if ((segment->memtype & DFUSE_ERASABLE) && !dfuse_mass_erase) {
+			dfuse_special_command(dif, address, ERASE_PAGE);
+		}
+		p = p + segment->pagesize;
+	}
+
 	dfu_progress_bar("Download", 0, 1);
 
 	for (p = 0; p < (int)dwElementSize; p += xfer_size) {
-		int page_size;
-		unsigned int erase_address;
 		unsigned int address = dwElementAddress + p;
 		int chunk_size = xfer_size;
 
@@ -414,35 +424,11 @@ int dfuse_dnload_element(struct dfu_if *dif, unsigned int dwElementAddress,
 			errx(EX_IOERR, "Page at 0x%08x is not writeable",
 				address);
 		}
-		page_size = segment->pagesize;
 
 		/* check if this is the last chunk */
 		if (p + chunk_size > (int)dwElementSize)
 			chunk_size = dwElementSize - p;
 
-		/* Erase only for flash memory downloads */
-		if ((segment->memtype & DFUSE_ERASABLE) && !dfuse_mass_erase) {
-			/* erase all involved pages */
-			for (erase_address = address;
-			     erase_address < address + chunk_size;
-			     erase_address += page_size)
-				if ((erase_address & ~(page_size - 1)) !=
-				    last_erased_page)
-					dfuse_special_command(dif,
-							      erase_address,
-							      ERASE_PAGE);
-
-			if (((address + chunk_size - 1) & ~(page_size - 1)) !=
-			    last_erased_page) {
-				if (verbose > 2)
-					printf(" Chunk extends into next page,"
-					       " erase it as well\n");
-				dfuse_special_command(dif,
-						      address + chunk_size - 1,
-						      ERASE_PAGE);
-			}
-		}
-
 		if (verbose) {
 			printf(" Download from image offset "
 			       "%08x to memory %08x-%08x, size %i\n",

[-- Attachment #3: dfu-remove-vendor-check.patch --]
[-- Type: text/x-patch, Size: 853 bytes --]

diff --git a/src/main.c b/src/main.c
index 30a9bd8..516a460 100644
--- a/src/main.c
+++ b/src/main.c
@@ -655,16 +655,6 @@ status_again:
 		break;
 
 	case MODE_DOWNLOAD:
-		if (((file.idVendor  != 0xffff && file.idVendor  != runtime_vendor) ||
-		     (file.idProduct != 0xffff && file.idProduct != runtime_product)) &&
-		    ((file.idVendor  != 0xffff && file.idVendor  != dfu_root->vendor) ||
-		     (file.idProduct != 0xffff && file.idProduct != dfu_root->product))) {
-			errx(EX_IOERR, "Error: File ID %04x:%04x does "
-				"not match device (%04x:%04x or %04x:%04x)",
-				file.idVendor, file.idProduct,
-				runtime_vendor, runtime_product,
-				dfu_root->vendor, dfu_root->product);
-		}
 		if (dfuse_device || dfuse_options || file.bcdDFU == 0x11a) {
 		        if (dfuse_do_dnload(dfu_root, transfer_size, &file,
 							dfuse_options) < 0)

  parent reply	other threads:[~2015-01-30 21:56 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-17  9:03 usb_8dev: firmware and windows library "Bernd Krumböck"
2013-01-17 16:32 ` Oliver Hartkopp
2013-01-17 20:24 ` Robert Schwebel
2013-01-18 10:43 ` Uwe Bonnes
2014-01-21 11:50 ` Oliver Hartkopp
2014-01-21 11:57   ` Gediminas Simanskis
2014-01-21 12:19     ` bon
2014-01-21 16:03       ` Gediminas Simanskis
2014-01-21 16:07         ` bon
2014-01-22  5:42           ` Gediminas Simanskis
2014-01-22 12:58     ` Bernd Krumboeck
2014-01-22 14:46       ` Marc Kleine-Budde
2014-01-25  7:04         ` Bernd Krumboeck
2014-01-25  8:29           ` Brennan Ashton
2014-01-25  9:08             ` Bernd Krumboeck
2014-01-25 15:55               ` Brennan Ashton
2014-01-25 16:55                 ` Oliver Hartkopp
     [not found]                   ` <52E4CEA2.5030407@universalnet.at>
2014-01-26  9:22                     ` Gediminas Simanskis
2014-01-26  9:38                       ` Bernd Krumboeck
2014-01-26 10:04                         ` Gediminas Simanskis
2014-01-26 20:56                           ` Bernd Krumboeck
2014-01-25 11:04           ` Oliver Hartkopp
2014-01-25 11:45             ` Oliver Hartkopp
2015-01-30 21:56           ` Oliver Hartkopp [this message]
2015-01-30 22:09             ` Bernd Krumboeck
2015-01-31 10:09               ` Oliver Hartkopp

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54CBFE09.9000700@hartkopp.net \
    --to=socketcan@hartkopp.net \
    --cc=gediminas@8devices.com \
    --cc=krumboeck@universalnet.at \
    --cc=linux-can@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).