Colleen Przybyla wrote:
From user space, just stick to the file system API ... if for any
reason that's not working, it's just a bug.  It should keep you from
being too wrong.  In this case it sounds like you've strayed off the
path of righteousness by some indeterminate amount.


- Dave


I'm trying to work my way though the debug messages from the kernel, and
I had a couple of questions.  I've inserted my own 'printk' commands
alongside of each DBG line of code as I've had some trouble turning on
verbosity and debug messages in make config.  I've tried enabling a

It's not a "config" option. Just enable the lines at the top of the "inode.c" source file.


variety of the different 'debug' options with no success on seeing the
printouts.  Is there a simple way to do this which will eliminate the
need for all the 'printk' statements?

For the time being however, the printk statements are providing the same
functionality as the DBG messages would. I've been able to follow the
endpoint configuration through from the printk output statements.


The user level program is trying to set up and configure an IN "ep1"
which is described by an interrupt endpoint descriptor.

I don't think any of the currently available controller drivers have an endpoint with that name...


The kernel messages show that upon a SET_CONFIGURATION request, gadgetfs
properly attempts to set up the endpoint by running ep_open successfully
and entering into ep_config.  However, in both of these functions, the
kernel is trying to set up ep->name "ep2out-bulk", not "ep1".

You were using the 2.4 version of the driver, right? That's probably where the issue came up. You had to "mknod" a bunch of character special files, and didn't match their minor numbers to match what the controller driver uses.

See the attached script.

This particular set of issues wouldn't come up if you did the
work on a 2.6 kernel.  It's one of the reasons that the 2.4
version of "gadgetfs" is particularly "experimental".  (And
in fact, on 2.4 it's not actually a filesystem ... although
the user mode API is the same as on 2.6, where it is.)


"ep2out-bulk" is not defined anywhere in the user level code, nor in the
inode.c file.  I haven't been able to determine how the epfiles list of
endpoints is set up for the API, or how the entries to this was defined.

Actually the names don't matter as much as how they correspond to the names used by the gadget controller. "ep2out-bulk" makes me think you've got a pxa2xx_udc driver.

In that case you'll want something "mknod ep1in-bulk c 240 1".


How would I set this list to configure the endpoint I'm calling from the
user level code?  It seems that the user level code would be able to
complete the ep configuration correctly if the kernel were configuring
the correct endpoint....

This is an advantage of using the 2.6 gadgetfs code, which can throw the names from the gadget controller right into the file system, and keep problems like that from happening.

Of course, someone could also do the same thing with the 2.4
code, but that person would need to be more fluent in how
the 2.4 filesystem code works than I am.  And it's just a lot
easier to do this stuff on 2.6 in any case ... :-)

- Dave



Best, Colleen



#!/bin/bash
# makes /dev/gadget files for device-side usb controllers

DIR=/dev/gadget

# major numbers 240-254 are reserved for local/experimental use
: ${MAJOR:=240}

# different device side usb controllers expose different resources
: ${CHIP:=net2280}

umask 0022
rm -rf $DIR
mkdir $DIR
cd $DIR

# make name minor
make ()
{
        mknod $1 c $MAJOR $2
        # and maybe chown
}

make $CHIP 0
# ln -s $CHIP ep0

# controllers have up to 30 non-control endpoints.
case $CHIP in
net2280)
        make ep-a 1
        make ep-b 2
        # fifo mode may change so that ep-d and/or ep-c vanish, which
        # breaks this default number-to-name mapping for ep-e and ep-f
        # this assumes "modprobe net2280 fifo_mode=0" (the default)
        make ep-c 3
        make ep-d 4
        make ep-e 5
        make ep-f 6
        ;;
pxa25x)
        make ep1in-bulk 1
        make ep2out-bulk 2
        make ep3in-iso 3
        make ep4out-iso 4
        make ep5in-int 5
        #
        make ep6in-bulk 6
        make ep7out-bulk 7
        make ep8in-iso 8
        make ep9out-iso 9
        make ep10in-int 10
        #
        make ep11in-bulk 11
        make ep12out-bulk 12
        make ep13in-iso 13
        make ep14out-iso 14
        make ep15in-int 15
        ;;
sa11x0)
        make ep1out-bulk 1
        make ep2in-bulk 2
        ;;
*)      echo unrecognized USB controller: $CHIP ; exit 1 ;;
esac

Reply via email to