USB Devices

Post Reply
drakesword
Posts: 5
Joined: Tue Nov 16, 2010 8:21 pm

USB Devices

Post by drakesword » Tue Nov 16, 2010 8:24 pm

Hello,

I would like to start writing code for external USB devices but do not know where to get started.

Specifically I would like to write some code to communicate to a usb-serial device.

Any help is greatly appreciated!

drakesword
Posts: 5
Joined: Tue Nov 16, 2010 8:21 pm

Re: USB Devices

Post by drakesword » Wed Nov 17, 2010 7:32 pm

I found some more information.

WiiXplorer only does file systems.

I'm looking into other devices. Like a FTDI USB to Serial adapter which is part of an arduino.

Ultimately I want to send commands to an arduino for reading sensors and such.

What I found is that I need to use ios_open("/dev/usb/oh1/VID/PID");

Question. What is the difference between oh1 and oh0?

I just assume that one is oh0 is one usb port while 0h1 is the other or am I wrong?

obcd
Posts: 21
Joined: Mon Jan 19, 2009 10:09 pm

Re: USB Devices

Post by obcd » Wed Nov 17, 2010 10:38 pm

USB client devices are divided in classes. You have the HID class that handles input devices like mice and keyboards.
You have the Storage class that handles usb disks and usb memory devices.
You also have the serial devices and other custom devices. I don't know if those have a general class name.

Most modern os have a usb host driver that takes care of the hardware interface. It communicates to several client drivers for the connected devices.

I have no idea how well the wii follows that scenario. You will find code for usb memory devices and code for usb hid devices (usb keyboard), but I don't think usb 2 serial devices are covered yet.

Considering those dongles (which is what you are trying to connect I assume), you have 2 different brands. You have the ftdi chipsets and the prolific chipsets. I don't think there is a standardisation like there is with mice, keyboards and memory devices. Sometimes usb devices have the ftdi or a compatible chipset embedded into them.

An approach that might be easier to implement is using an ethernet to serial module, and connecting to that with an ethernet connection. It is a more expensive approach, but writing the code to drive an usb2serial device will be an imense job.

You could download a windows CE Platform Builder trial. It contains the sources for the different usb classes drivers. You should be able to find something like that for linux as well. The datasheets of the chipset manufacturers can be usefull as well. I believe they even provide the sources for the drivers for most used oses.

Good luck with it.

drakesword
Posts: 5
Joined: Tue Nov 16, 2010 8:21 pm

Re: USB Devices

Post by drakesword » Fri Nov 19, 2010 4:33 am

Would I be better off running software over top of Whiite Linux?

Eventually I would like to use the wii to control some external hardware for home automation

obcd
Posts: 21
Joined: Mon Jan 19, 2009 10:09 pm

Re: USB Devices

Post by obcd » Fri Nov 19, 2010 10:19 am

I don't know how mature linux for wii is for the moment. If there is full usb support, it might be a good way to do things.

It's just moderate complex to make a network link between the Wii and another network enabled device.
You could use your pc as a sort of bridge to start with. If you have things going that way, you can consider an embedded ethernet2serial.

An european magazine elektor had a nice pcb a couple of years ago called the digibutler. It was a small pcb with an embedded 32 bit microcontroller. It had an ethernet interface and a serial port and only costed 40 - 50 euro. If you have no soldering or electronic experience, you can take a look at the "digi connect me" devices. I believe they have off the shelf prebuild modules that function as an ethernet 2 serial gateway. Even if you follow that approach, you can still program it in linux if you know that environment better.

You could save on cables as well if you already have an existing ethernet infrastructure in your house. You can place the gateway close to the device you want to control.

drakesword
Posts: 5
Joined: Tue Nov 16, 2010 8:21 pm

Re: USB Devices

Post by drakesword » Sat Nov 20, 2010 5:41 am

I was also thinking along the line of robotics. Wii seems perfect for a controller. Small, efficient, solid state drive, built in wifi, runs on 12V, bluetooth with code for a couple 3 axis accelerometers and 3 axis gyro.

I don't need just to talk to serial. The device I am working with is an uC that communicates via its onboard usb->serial which is FDTI.

I can build an ethernet to uC controller for about $25 but that is not what I am looking for. Just want to prototype now and access the usb would allow greater capabilities in the long run anywho (like webcams and such)

obcd
Posts: 21
Joined: Mon Jan 19, 2009 10:09 pm

Re: USB Devices

Post by obcd » Mon Nov 22, 2010 12:28 pm

I am a newby in the wii scene.

I was under the impression that all the hardware interfacing was done by the wii arm processor.
The firmware for this is one of the wii ios.
Homebrew code runs on the ppc processor. The interfacing with the ios is handled by the libs like libogc.
I don't know if there is sample code available for the ios. Wanikoko and Hermes created some cios which are
modified, patched ios.

If you want to add functionallity to the Wii usb, you will need to create an ios for it.
After that, you will need to create a library that communicates with that ios and
has support for the new functionallity.

I could be wrong about this approach, so feel free to argue.

fernandohildebrand
Posts: 5
Joined: Mon Jan 24, 2011 1:27 pm

Re: USB Devices

Post by fernandohildebrand » Mon Jan 31, 2011 5:37 pm

I'm doing a little project that involves using a 3D sound with regular headsets, and a microphone (mic). In Wii that would have to be a USB device. Is there such a interface to it already? Or would it have to be a complementary lib on top of libog?

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest