Hacking cIOSX rev21d2x: Yet Another Hot Fix!!!!

Did d2x work for you?

  • Yes, I had an issue with the official cios and d2x fixed it

    Votes: 93 48.2%
  • Yes, but everything was already working for me with the official cios

    Votes: 82 42.5%
  • No, and I posted what goes wrong

    Votes: 9 4.7%
  • No, and I won't report what goes wrong because I am a troll

    Votes: 9 4.7%

  • Total voters
    193

digicroxx

New Member
Newbie
Joined
Apr 8, 2012
Messages
2
Trophies
0
XP
7
Country
Italy
I used the d2X CIOS with several USB memory sticks.
Everything was working fine but unfortunately I start having problems when I tried to use the USB port to access the HDD of

my Emtec movie cube.

It would be so nice for me to be able to access the HDD inside it (I have placed it just on the side of the wii console...)

that I didn't give up and I started study why this USB HDD was now working.

(At this point I have to thank davebaol and the others coders for having released the source code of the CIOS...)

After several nights of tests I found the reason(s) why the CIOS was not working with this USB HDD and modified the ehci

module to let it work.

I release the modified CIOS and the source code, maybe this can help other people with "problematic" HDDs.

You can find them here...

http://www.hackwii.i...20058-1400.html


For who are interested in technical details:

There were two problems:

The first problem was related to a strange way to answer to the __usb_getdesc(fd, buffer, USB_DT_CONFIG, iConf,

ucd->wTotalLength) function in USB_GetDescriptors().


In my case between the configration descriptor and the interface descriptors there were 3 bytes of an "OTG"

descriptor (Id=09).

Here is the dump of the answer:
There are the 9 bytes of the configuration descriptor (id=02) followed by the 3 unexpected bytes...

Code:
					Configuration descr.  OTG	Interface descriptor Endpoint descriptors...
C Ci:1:008:0 0 35 = 09022300  010104e0  01030903 09040000 02080650 05 070581 02000200 07050102
1 2 3 4   5 6 7 8   9 ^^^^^^ 1 2 3 4  5 6 7 8  9

The result of a lsusb command:

Code:
Bus 001 Device 005: ID 0525:a4a5 Netchip Technology, Inc. Linux-USB File Storage Gadget
libusb couldn't open USB device /dev/bus/usb/001/005: Permission denied.
libusb requires write access to USB device nodes.
Couldn't open device, some information will be missing
Device Descriptor:
bLength				18
bDescriptorType		 1
bcdUSB			   2.00
bDeviceClass			0 (Defined at Interface level)
bDeviceSubClass		 0
bDeviceProtocol		 0
bMaxPacketSize0		64
idVendor		   0x0525 Netchip Technology, Inc.
idProduct		  0xa4a5 Linux-USB File Storage Gadget
bcdDevice			3.99
iManufacturer		   1
iProduct				2
iSerial				 3
bNumConfigurations	  1
OTG Descriptor:
bLength				 3
bDescriptorType		 9
bmAttributes		 0x03
SRP (Session Request Protocol)
HNP (Host Negotiation Protocol)
Configuration Descriptor:
bLength				 9
bDescriptorType		 2
wTotalLength		   35
bNumInterfaces		  1
bConfigurationValue	 1
iConfiguration		  4
bmAttributes		 0xe0
Self Powered
Remote Wakeup
MaxPower				2mA
Interface Descriptor:
bLength				 9
bDescriptorType		 4
bInterfaceNumber		0
bAlternateSetting	   0
bNumEndpoints		   2
bInterfaceClass		 8 Mass Storage
bInterfaceSubClass	  6 SCSI
bInterfaceProtocol	 80 Bulk (Zip)
iInterface			  5
Endpoint Descriptor:
bLength				 7
bDescriptorType		 5
bEndpointAddress	 0x81  EP 1 IN
bmAttributes			2
Transfer Type			Bulk
Synch Type			   None
Usage Type			   Data
wMaxPacketSize	 0x0200  1x 512 bytes
bInterval			   0
Endpoint Descriptor:
bLength				 7
bDescriptorType		 5
bEndpointAddress	 0x01  EP 1 OUT
bmAttributes			2
Transfer Type			Bulk
Synch Type			   None
Usage Type			   Data
wMaxPacketSize	 0x0200  1x 512 bytes
bInterval			   1


The original code was not handling this and everything was going wrong without finding the interface descriptord anymore.




The second problem was in the USBStorage_ReadCapacity function.
Specs defines that SCSI_READ_CAPACITY has a Command Descriptor Block that is 10 bytes long.

http://www.usb.org/d...bmass-ufi10.pdf PAG 32

http://en.wikipedia....apacity_Command

My Emtec HDD was strictly requiring that, while the ofiginal ehci code was sending only the first 2 nonzero bytes.



After fixing this two things in the ehci module everything was working.

Hope this can help.
 
  • Like
Reactions: 1 person

davebaol

Well-Known Member
OP
Member
Joined
Sep 3, 2010
Messages
912
Trophies
0
XP
192
Country
Italy
Uncle_Sam_I_Want_You_1.jpg

Ok looking for testers.
As you can see above digicroxx submitted a d2x patch to improve compatibility with certain problematic hdd.
Now I want to check backward compatibility with hdd that were already working before.
Nothing special to test, just check your hdd still works.
And of course if you have a hdd that was not supported try it too.
Come on #wiiflow irc channel to grab the latest d2x beta.
 

actar

Well-Known Member
Member
Joined
Feb 3, 2011
Messages
371
Trophies
0
Location
Torino (Italy)
XP
214
Country
Italy
Here I am!

First thing I would say that to me is everything ok.

But here's the hard drives that I tried (always and only with USB Loader GX r 1155):

Obviously with d2x-v9-beta(r47MOD1)

HD 2.5" WESTERN DIGITAL 1TB
File System: NTFS
Loader on SD (FAT32)

HD 2.5" IOMEGA SELECT 500GB
File System: WBFS
Loader on SD (FAT32)

HD 2.5" LACIE RIKKI 500GB
File System: FAT32
Loader on hard disk


I haven't try using saves or WiiWare on emulated nand, but only by playing Wii games launching in "standard" mode


Edit:
I forgot to mention one important thing:
Apart from the WD (that I bought not long time ago) this hard disk has always worked fine for me.
 
  • Like
Reactions: 1 person

davebaol

Well-Known Member
OP
Member
Joined
Sep 3, 2010
Messages
912
Trophies
0
XP
192
Country
Italy
Thank you actar. :)

Current test result is still too short but seems promising....

Code:
+---------------+-------------------+----------------------+
| User          | Already supported | Not supported before |
|               |    OK      FAIL   |    OK        FAIL    |
+---------------+-------------------+----------------------+
| digicroxx     |    2        -     |    1          -      |
| FIX94         |    1        -     |    -          -      |
| JoostinOnline |    1        -     |    -          -      |
| Actar         |    3        -     |    -          -      |
+---------------+-------------------+----------------------+
 
  • Like
Reactions: 1 person

davebaol

Well-Known Member
OP
Member
Joined
Sep 3, 2010
Messages
912
Trophies
0
XP
192
Country
Italy
Actually I didn't know where this patch come from.
Do you really think that if I had known I would have searched for testers?
I respect libogc devs enough to consider that library an excellent testbed in itself.
:P

EDIT:
Also when I borrow some code from others I always mention them in changelog/credits.
And your quoted "borrow" is somewhat irritating since it seems to imply that I'm a thief.
Finally everybody knows you're (one of) the best dev out there, you don't have to be arrogant to prove it to the world.
Anyways thanks for the info man. :)
 

digicroxx

New Member
Newbie
Joined
Apr 8, 2012
Messages
2
Trophies
0
XP
7
Country
Italy
*cough* *cough*
libogc got these fixes years ago, if you're going to "borrow" code from there maybe you should update it occasionally...

In my post I have described deep enough the problem I had with the ehci module of d2x cIOS, and think it's clear that I made my homework and found the solution by myself without "borrowing" code from somewhere else.

Then, it's true, I see now that in usb.c of libogc there is the __find_next_endpoint() function that makes the same task of my patch.
When the problem is known, there are not many different ways to write the code to fix it... (the codes are different anyway...)

If somebody has already found and fix the same problem somewhere else, sorry if I have wasted my time "re-inventing the wheel".
 

davebaol

Well-Known Member
OP
Member
Joined
Sep 3, 2010
Messages
912
Trophies
0
XP
192
Country
Italy
Yeah reinventing the wheel is not so unusual as you might think.
And when it happens is not wasted time anyways.
In fact you still can be proud enough to say "I did it all by myself" and for sure you learned a lot more than just copying/studying someonelse's code.
Great work, fellow. :grog:
.
 

tueidj

I R Expert
Member
Joined
Jan 8, 2009
Messages
2,569
Trophies
0
Website
Visit site
XP
999
Country
digicroxx: my comments were not directed at you, but the cios authors who took their usbstorage code from libogc and never bothered to update it. If they had you probably never would have had any issues. I wonder if any of the nasty libfat bugs have been corrected either, or if writing is so infrequently used that nobody has reported them.
 

Burton

Real Life VIP and Educator
Member
Joined
Mar 7, 2006
Messages
880
Trophies
0
Website
Visit site
XP
283
Country
digicroxx: my comments were not directed at you, but the cios authors who took their usbstorage code from libogc and never bothered to update it. If they had you probably never would have had any issues. I wonder if any of the nasty libfat bugs have been corrected either, or if writing is so infrequently used that nobody has reported them.
Where are they now? LOL
 

davebaol

Well-Known Member
OP
Member
Joined
Sep 3, 2010
Messages
912
Trophies
0
XP
192
Country
Italy
Well personally I inherited ehci code from kwiirk, waninkoko, hermes and of course libogc.
Rodries and me just updated it to work with interrupts to detect usb ports status changes.
Actually I've never looked into libogc usbstorage because I work 10 hours per day and my spare time is not enough to improve libogc too.
But if I should find a bug in libogc I would certainly submit a patch.
I've repeatedly proved to share my knowledge with everybody else regardless of the project they are working on.
 
  • Like
Reactions: 10 people

187skillz

Well-Known Member
Newcomer
Joined
Mar 15, 2009
Messages
55
Trophies
1
Age
34
Location
Palace Of Wisdom
Website
t.co
XP
344
Country
Saint Kitts and Nevis
can someone please help a brother out so I'm running cIOS d2x v8 Final i'm using CFG USB loader for my wii games....and use USB Loader GX for Virtual Console/Wiiware games installed on my emu nand(which is back up of my real nand btw)placed on my 4GBSDHC when playing wiiware games that have online features bomberman for e.g I can't connect online I get error code 20109...
 

flamepanther

Well-Known Member
Member
Joined
Apr 16, 2011
Messages
159
Trophies
0
XP
196
Country
United States
can someone please help a brother out so I'm running cIOS d2x v8 Final i'm using CFG USB loader for my wii games....and use USB Loader GX for Virtual Console/Wiiware games installed on my emu nand(which is back up of my real nand btw)placed on my 4GBSDHC when playing wiiware games that have online features bomberman for e.g I can't connect online I get error code 20109...
That's a known issue for awhile now. Unfortunately, the cause is still something of a mystery. All loaders are affected.
 

187skillz

Well-Known Member
Newcomer
Joined
Mar 15, 2009
Messages
55
Trophies
1
Age
34
Location
Palace Of Wisdom
Website
t.co
XP
344
Country
Saint Kitts and Nevis
can someone please help a brother out so I'm running cIOS d2x v8 Final i'm using CFG USB loader for my wii games....and use USB Loader GX for Virtual Console/Wiiware games installed on my emu nand(which is back up of my real nand btw)placed on my 4GBSDHC when playing wiiware games that have online features bomberman for e.g I can't connect online I get error code 20109...
That's a known issue for awhile now. Unfortunately, the cause is still something of a mystery. All loaders are affected.
Well, online connection works with iso forwarders.

ahhh that sucks...hope it gets fixed and about the iso fowarders...hmm..well i know how to make a channel but not with a vc/wiiware game ill have to look into that
 

airline38

Well-Known Member
Member
Joined
Mar 28, 2010
Messages
741
Trophies
1
XP
807
Country
Taiwan
Just testedd2x-v9-beta(r47MOD1) on my Toshiba CANVIO V5 USB 3.0 750GB HD.

It works well by using CFG USB Loader+cIOS249[56].
(didn't work with d2x v7 or v8 or v9betar47)

I think the compatibility is really improved !!
 
  • Like
Reactions: 2 people

Arm73

Well-Known Member
Member
Joined
Mar 4, 2006
Messages
2,046
Trophies
0
Location
Switzerland
XP
587
Country
Italy
Just testedd2x-v9-beta(r47MOD1) on my Toshiba CANVIO V5 USB 3.0 750GB HD.

It works well by using CFG USB Loader+cIOS249[56].
(didn't work with d2x v7 or v8 or v9betar47)

I think the compatibility is really improved !!

I tested it as well, but unfortunately, it still doesn't work properly with my Toshiba CANVIO USB 2.0/3.0 500GB HD
Before the update, CFG would simply freeze on the splash screen, now it looks for the HD and the countdown begins, but I still need to unplug and then replug the HD in.
It randomly works by reloading iso 249, but not every time.

I have the same problem with the latest beta of the USB loader GX (R1156_IOS249_MOD11 ) .
Any help or tips for my problem ? I know I should have gotten a WD instead, but the glossy white Toshiba seemed to be such a perfect match for my Wii.........;)
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
  • Xdqwerty @ Xdqwerty:
    yawn
  • Xdqwerty @ Xdqwerty:
    anybody here?
  • P @ PKNate:
    nope
  • BakerMan @ BakerMan:
    fun fact: 7 years by lukas graham, supermassive black hole by muse, and megalomania all have the same bpm
  • BakerMan @ BakerMan:
    girls just wanna have fun and renai circulation also share the same tempo as the few i said before
  • Xdqwerty @ Xdqwerty:
    @BakerMan, megalomania the live a live song?
  • BakerMan @ BakerMan:
    wait no, megalovania*
  • BakerMan @ BakerMan:
    my bad
  • K3Nv2 @ K3Nv2:
    I don't forgive you
  • BigOnYa @ BigOnYa:
    The nerve of that guy, gosh.
  • K3Nv2 @ K3Nv2:
    Yeah expecting me to forgive gtfo
  • Psionic Roshambo @ Psionic Roshambo:
    But how could the Dr have known you didn't want to be circumcized?
  • K3Nv2 @ K3Nv2:
    He didn't you just wanted your dick to be fondled
    +1
  • K3Nv2 @ K3Nv2:
    Watching dune 2 it's eh
  • Psionic Roshambo @ Psionic Roshambo:
    Dune one sucked
  • Psionic Roshambo @ Psionic Roshambo:
    The original with Patrick Stewart was Great
  • K3Nv2 @ K3Nv2:
    A sexual psycopath that love pain where have I heard that before
  • BigOnYa @ BigOnYa:
    In your high school diary?
  • K3Nv2 @ K3Nv2:
    No but your wife let's me read her diary the word psychopath comes up more than sexual
    +1
  • K3Nv2 @ K3Nv2:
    Lol stremio hogging all of my tvs on board ram
  • BigOnYa @ BigOnYa:
    Just download more Ram to it, or setup Raid666 on it.
    +1
  • SylverReZ @ SylverReZ:
    Morning
    SylverReZ @ SylverReZ: Morning