Rockbox Technical Forums

Installation / Removal => Manual Installation => Sandisk - Installation/Removal => Topic started by: zajacattack on September 14, 2007, 06:26:33 PM

Title: Rockbox on e280R with Windows
Post by: zajacattack on September 14, 2007, 06:26:33 PM
OK, so I compiled e200tool with cygwin, then I used libusb-win32 to create a driver for the device in manufacturing mode (0781:0720, manufacturer="Sandisk", and device="Sansa e280"). Now, libusb-win32 recognizes it in the "Test Program", and e200tool finds the device. Then, however, e200tool says "Failed to claim the interface, (-22, invalid argument)". Is there a way to fix this (maybe in the driver I made or something in libusb-win32)?
Title: Re: Rockbox on e280R with Windows
Post by: linuxstb on September 14, 2007, 06:49:27 PM
You should really be testing e200rpatcher, not e200tool - e200rpatcher is the program we need to make run on Windows, and it does less than e200tool, so might work where e200tool doesn't.

But having said that, the problem you're reporting with e200tool is exactly the same as someone else who did exactly the same as you with e200rpatcher.  That's the current hurdle.

You will probably be better off trying to seek help from the libusb-win32 developers.  Maybe post to their mailing list (if they have one), and include a link to the e200rpatcher source, along with a description of what you've done and what the problem is.

EDIT: A quick google points to this page with what looks like a solution:

http://osdir.com/ml/lib.libusb.devel.windows/2006-05/msg00037.html

So you could try adding "usb_set_configuration(dh, 1);" just before the call to usb_claim_interface() in e200rpatcher.c and see if that helps.

EDIT 2: Here's a win32 binary of e200rpatcher with that usb_set_configuration() line added.  Can you let me know what happens now?

http://www.davechapman.f2s.com/rockbox/e200rpatcher-win32.zip
Title: Re: Rockbox on e280R with Windows
Post by: zajacattack on September 14, 2007, 07:31:09 PM
OK, it ran fine, detected the Sansa and said it uploaded the code. So, where are some step-by-step directions to getting Rockbox on e200R with e200rpatcher. I want to see if it works.
Title: Re: Rockbox on e280R with Windows
Post by: linuxstb on September 14, 2007, 07:34:46 PM
When e200rpatcher ran, did anything appear on your Sansa's screen?   The patching application should run and display some messages on the screen.  If not, try running e200rpatcher again.

Running e200rpatcher replaces "step 1" in the install instructions - i.e. it patches the Sansa bootloader to allow you to install Rockbox.

Title: Re: Rockbox on e280R with Windows
Post by: zajacattack on September 14, 2007, 07:35:29 PM
No, nothing appeared, do I need to hold record while I do it or what?
Title: Re: Rockbox on e280R with Windows
Post by: linuxstb on September 14, 2007, 07:38:18 PM
No, you don't press RECORD at all - you should just do what e200rpatcher tells you.
Title: Re: Rockbox on e280R with Windows
Post by: zajacattack on September 14, 2007, 08:03:56 PM
OK, here's a summary of what happened (p.s. I tried three different drivers made by libusb-win32)

1. When using driver with manufacturer "Sandisk" and description "Sansa e280R", I got these errors:

[ERR] Error writing data length
[ERR] Bulk write error (-5, Input/output error)
[ERR] Upload of application failed

2. When using driver with manufacturer "Sandisk" and description "USB device", it said it was successful, but nothing showed up on my sansa's screen.

3. When using driver with manufacturer "Sandisk" and description "Sansa e280", it said it was successful, but nothing showed up on my sansa's screen.

P.S. Is there a chance that it did patch, but did not write to the screen? If so, should I try loading rockbox?
Title: Re: Rockbox on e280R with Windows
Post by: chrisjs169 on September 14, 2007, 08:35:54 PM
Quote
P.S. Is there a chance that it did patch, but did not write to the screen? If so, should I try loading rockbox?
I tried it on my Sansa - it seems the uploaded code isn't being accepted, because the Sansa 'exists' Manufacturing mode (if you try running e200rpatcher again, it won't find the Sansa until you turn it off/back on) but nothing appears on the screen, and the bootloader isn't patched.
Title: Re: Rockbox on e280R with Windows
Post by: zajacattack on September 14, 2007, 09:11:19 PM
OK, if we want this on Windows, someone is going to have to write code that DOES NOT use libusb-win32. It has problems with the device in manufacturing mode. There must be something else that will work better (perhaps DirectX [http://www.adontec.com/driverx_usb.htm] or USBIO development kit [http://www.thesycon.de/eng/usbio.shtml]).
Title: Re: Rockbox on e280R with Windows
Post by: e280ruser on September 14, 2007, 10:31:37 PM
OK, if we want this on Windows, someone is going to have to write code that DOES NOT use libusb-win32. It has problems with the device in manufacturing mode. There must be something else that will work better (perhaps DirectX [http://www.adontec.com/driverx_usb.htm] or USBIO development kit [http://www.thesycon.de/eng/usbio.shtml]).

The first link is to DriverX, not DirectX.  Plus, it is non-free, and as far as I can tell closed source.  And  it's the same deal with the other link that you posted.

We have the library, we just need to make it work.  Let's remember that it's not that great of an idea to reinvent the wheel, especially when you're driving blindly.

Quote from: USBIO development kit (http://www.thesycon.de/eng/usbio.shtml)
Developing a kernel-mode WDM driver is considerably different to developing Windows applications. It requires specialist knowledge in kernel-mode programming and a deep understanding of operating system internals. The development and debugging process can be very time-consuming, especially if the driver has to support different Windows versions (e.g. Windows 98, Windows 2000, Windows XP, and Windows Vista).

Libusb is pretty much the only stable (kind of), open source, free library of usb funtions that I have found for windows as of yet, probablly due in part to the large amount of cash needed for the Windows SDK.  Keep looking, and remember, it has to be free.
Title: Re: Rockbox on e280R with Windows
Post by: zajacattack on September 15, 2007, 01:10:12 AM
OK, I modified e200tool.c so that it said:

Code: [Select]
usb_set_configuration(ud, 1);
usb_claim_interface(ud, E200_INTERFACE);

Now, it compiled fine and will find my e280R and connect to it fine; however, the usb_set_configuration call does something that causes Windows to disconnect and reconnect the Sansa. So, e200tool cannot do much past initializing the stud before the Sansa is disconnected. For example, when I did "e200tool recover BL_SD_boardSupportSD.rom", e200tool found the Sansa, initialized the stub, wrote the file to the RAM, then lost the connection. This is because there is a small amount of time between the usb_set_configuration call and Windows disconnection, but not much. Plus, it does this on e200tool AND e200rpatcher when they have the call to usb_set_configuration. Now, is there a way to make this call without disconnecting and reconnecting the device?
Title: Re: Rockbox on e280R with Windows
Post by: bluebrother on September 15, 2007, 04:14:27 AM
Now, is there a way to make this call without disconnecting and reconnecting the device?
I guess you best ask the libusb-win32 developers about this ...
Title: Re: Rockbox on e280R with Windows
Post by: linuxstb on September 15, 2007, 04:22:07 AM
Could a Linux user test adding the usb_set_configuration() line to e200rpatcher (see my earlier post in this thread) and see if it still works there?
Title: Re: Rockbox on e280R with Windows
Post by: zajacattack on September 15, 2007, 04:45:37 PM
I DID IT! My e280R is now running Rockbox, and I patched the BL with e200tool under Windows. Well, I did have to recompile e200tool with the line usb_set_configuration(ud, 1);. Then, the second problem was, I had used inf-wizard to create a driver for the e200R is Manufacturing mode (0781:0720), but when e200tool initializes the USB stub, the device changes to 0666:E200. So, I created another driver for the device under 0666:E200. Then, I followed the directions for patching the BL with e200tool. Now, I am running Rockbox perfectly. I think the same goes for e200rpatcher (there needs to be two drivers).
Title: Re: Rockbox on e280R with Windows
Post by: linuxstb on September 15, 2007, 05:38:51 PM
That's great news, congratulations.

Would you be able to document the process for installing libusb on windows, and make your two .inf files available somewhere?  

Adding this info to the SansaE200RBootloaderPatching wiki page would be ideal, so we can then work on making an easy install guide.

EDIT: Would you also be able to test e200rpatcher, just to confirm it's working?  The 6666:E200 USB ID is something specific to e200tool, so it would seem that there could still be problems with e200rpatcher.
Title: Re: Rockbox on e280R with Windows
Post by: zajacattack on September 15, 2007, 06:01:50 PM
Yes, gladly; however, it does get tricky with the drivers. You have to install the first one (0781:0720), then run e200tool init. Then, you have to install the second one (0666:E200). Then, you must disconnect, shut off, and reconnect your Sansa in manufacturing mode. Finally, you can run through the steps to get to Recovery mode with the vanilla e200 BL. Then, you must UNinstall the first driver (0781:0720) so that Windows gets the device, not libusb. From there, it's drag-and-drop. But I can post detailed instructions if you think people can handle doing it.

And, I tried e200rpatcher again, it said it uploaded the patching application, but nothing showed up on my Sansa. So, I think that there's more work to be done with that.
Title: Re: Rockbox on e280R with Windows
Post by: linuxstb on September 15, 2007, 06:10:13 PM
OK, it sounds like e200tool is still too complex.  

Maybe it's simply that the binary I included with the e200rpatcher build I gave you was bad - I'll see if I can find a Linux user to test it.

(I don't have any Sansa, not even a plain E200, so can't do any of these tests myself).
Title: Re: Rockbox on e280R with Windows
Post by: zajacattack on September 15, 2007, 08:25:24 PM
Yeah, I think it's too complicated to be in the wiki, but if you post another version of e200rpatcher, I would be glad to test it. I can also compile a copy in cygwin if you give me the source. Also, could you upload the win32 binary of e200rpatcher again, along with bootloader.bin? You didn't give me bootloader.bin last time, and that might have been why it failed.
Title: Re: Rockbox on e280R with Windows
Post by: bluebrother on September 16, 2007, 07:57:42 AM
Yeah, I think it's too complicated to be in the wiki, but if you post another version of e200rpatcher, I would be glad to test it. I can also compile a copy in cygwin if you give me the source.
The sources are in svn ...
Title: Re: Rockbox on e280R with Windows
Post by: DJwilmz on September 19, 2007, 03:22:25 PM
Any chance u could provide step-by-step instructions, with links to whatever I need to download? I can handle complex instructions, I just need to know exactly what I need to do, step-by-step style.
Title: Re: Rockbox on e280R with Windows
Post by: bluebrother on September 19, 2007, 04:20:45 PM
Any chance u could provide step-by-step instructions, with links to whatever I need to download?
Please follow our posting guidelines. "u" is not a real word and not allowed here.

Besides, unless you really know what you are doing you shouldn't try to build yourself e200rpatcher and mess around with your player -- it's being worked on a safer and easier  way. If you tell you need a "step-by-step" style I doubt it's safe messing with your player ...
Title: Re: Rockbox on e280R with Windows
Post by: DJwilmz on September 19, 2007, 06:03:31 PM
Sorry about that, I didn't know it was a rule here, it's not a rule anywhere else...I was just saying; if he did it, then he obviously knows what your supposed to do to get it installed; and if he knows what to do, he should be able to list the steps.
Title: Re: Rockbox on e280R with Windows
Post by: zajacattack on September 19, 2007, 08:28:52 PM
I cannot upload the directions. They can only be performed by advanced users and are definitely NOT for beginners. Just wait until e200rpatcher is fixed, and then you can install rockbox fairly easily.

By the way, I compiled e200rpatcher and ran it after installing my 0781:0720 driver found here (http://forums.rockbox.org/index.php?topic=12562.msg96301#msg96301) , the same thing happens. It claims the patching app was uploaded, but nothing displays on my Sansa's screen and nothing is modified.
Title: Re: Rockbox on e280R with Windows
Post by: alphagator on April 22, 2008, 11:28:09 AM
Hi, I am trying to load Rockbox on my Sansa e260R and I trying to do the special steps neccesary for a Rhapsody, and get a error previously mentioned in this thread:
[ERR] Error writing data length
[ERR] Bulk write error (-5, Input/output error)
[ERR] Upload of application failed

I was successful in getting it into manufacturer's mode by following the prescribed steps.  I think I also loaded the new driver.  But in installing the e200rpatcher.exe file, got the above mentioned error.

I am not a coder, so your help will be appreciated!  Also, I am not sure whether I should take the player out of manufacturer mode since it is in this "in between" state or not.

Can anyone suggest what I did wrong?
Title: Re: Rockbox on e280R with Windows
Post by: zajacattack on April 22, 2008, 05:47:55 PM
The cause of that error is currently unknown. All I can tell you is to keep trying it until it works.
Title: Re: Rockbox on e280R with Windows
Post by: cut_and_flow on April 02, 2009, 01:21:50 PM
I had the same problem. Directions are attached in a pdf. If someone wants to repost them in the forum in plain text go ahead.
Title: Re: Rockbox on e280R with Windows
Post by: Llorean on April 02, 2009, 02:09:29 PM
I've removed your attachment. Documentation belongs typed into the wiki.