USB support for CHDK - General Discussion and Assistance - CHDK Forum supplierdeeply

USB support for CHDK

  • 4 Replies
USB support for CHDK
« on: 12 / February / 2009, 03:54:15 »
Hello folks,

I'd like to help you adding USB support to CHDK. I'm quite familiar with different USB hosts/device controllers and has been writing software for them. Could you tell current status of USB development?

We could try to implement USB Printer Support Class device because it has simplest protocol from firmware point of view as well as PC/Linux software. If we'll succeed then we can implement Mass Storage class device.

At my point I'd like to provide c source codes but we have to find out registers of the USB core, for example interrupt vector, interrupt flags register, USB status register, endpoint 0, 1, 2 FIFO registers. Do you know already which registers are related to USB?


I'm quite busy with my family and work but I'd like to support this project as much as possible.

Thank you!



Offline fudgey

  • *****
  • 1705
  • a570is
Re: USB support for CHDK
« Reply #1 on: 12 / February / 2009, 13:05:28 »
Any work on bringing USB stuff closer to reality is very welcome!

Current status as far as I can remember (all this is somewhere around these forums, but I don't have the time to search for links atm):

1) CHDK knows USB supply voltage status (this is what USB remote in CHDK uses) for more or less all ported cameras. How it does this can be found in the source code.
2) An address that switches USB high speed handshake resistor status has been found for one or two cameras a long long time ago. Experimenting with it has been found to be a fine way to crash the camera a lot (no permanent harm done).
3) Some data transfer things that have been successfully demonstrated using/modifying/extending Canon's USB functionality are enabling PTP in REC mode (usually the PTP tasks only start when in PLAY mode and USB supply voltage is present) and a hack to receive short commands from a PC via USB control data (ewavr didn't finish that into CHDK because it turned out the required functionality is only present in some firmwares).

Pretty much everything else is unknown I'm afraid.

CHDK doesn't change Canon's firmware, and thus not everything in it can be disabled or modified. This may make some things virtually impossible.

Re: USB support for CHDK
« Reply #2 on: 12 / February / 2009, 14:54:45 »
Are these register addresses same at every camera (I mean USB Vbus and pullup resistor bits)? I guess these are not at same area where are USB registers because these are probably simple general purpose I/O register bits?

Any idea where does firmware jump if USB interrupt occurs? Is it possible to reprogram USB vector address in interrupt core? Any info about interrupts, how to manage?

Lot of questions...

Btw, is there any disassembled code with any remarks/comments/notes about research of USB stuff you mentioned?
« Last Edit: 12 / February / 2009, 15:03:07 by linnar »


Offline fudgey

  • *****
  • 1705
  • a570is
Re: USB support for CHDK
« Reply #3 on: 12 / February / 2009, 17:00:11 »
I don't know much of anything about the pullup. I remember it's been mentioned on the forums a couple of times, just some random bit in a random address (well not random obviously, but I don't know where they come from).

Supply voltage things are handled by CHDK in platform/*/kbd.c I believe. I think it comes from physw_status, which is different for each camera in platform/*/sub/*/stubs_min.S and is also the source of keyboard and switch status to CHDK (I hope I'm not mistaken, I'm not very familiar with this part of CHDK).

I don't know if it's gpio register directly or something that has their values neatly read to a single location, maybe someone else does. No clue about interrupts either. I know tasks have been rewritten to inject code, but I'd imagine interrupt code would be harder to touch. Unless of course the vector address can be overwritten in a register as you suggest... I'm not an ARM expert either.


Offline reyalp

  • ******
  • 14098
Re: USB support for CHDK
« Reply #4 on: 13 / February / 2009, 01:22:59 »
The exception vector (including the IRQ handler) are copied to instruction TCM early in the boot process, just after the canon firmware initialized data and BSS are copied to RAM.

I haven't attempted to reverse the USB stuff myself, but there's lots of strings that look like they might offer a good starting point.

Don't forget what the H stands for.


Related Topics

SimplePortal 2.3.6 © 2008-2014, SimplePortal