On Friday 11 March 2005 5:51 pm, Mark Hurenkamp wrote: > Hi, > > > Calls to dbg() or warn() or info() would get replaced with > > calls to dev_dbg() or dev_warn() or dev_info() etc ... adding > > a newline at the end of the string), passing the struct device > > from the usb interface as the first parameter. > > I've been looking at the code in hid-core.c to see how I can best > go about to do this, and found that I'm somewhat confused by > the following. > > My guess is that hid_probe() is the entry point into the > calling tree, and it in turn calls usb_hid_configure(). > (passing on the intf pointer which I should be able to dereference > to get the device pointer). > However, then it calls hid_parse_report(), without passing on the > intf pointer, and thus it is losing the reference to the device > struct.
You could change that calling convention, and any descendants thereof... > From hid_parse_report() the different parsers hid_parse_main(), > hid_parse_global() and hid_parse_local() are called, which contain > some dbg() messages, but from there the device is not reachable > since as far as I can tell, in hid_parse_report() the reference > device->intf is not initialised... > Is there still a way to get access to the device? > Or could I simply pass the intf pointer from usb_hid_configure() > to hid_parse_report() and there assign it to device->intf so it can > be dereferenced later? Passing the interface to parse_report() sounds simplest. > Or would that cause problems elsewhere? > > What I'd like to do in hid_parse_local(): > dev_dbg(parser->device->intf->dev, "item data expected for local item"); > > And in open_collection(): > dev_dbg(parser->device->intf->dev, "collection stack overflow"); > > And in hid_add_field(): > dev_dbg(parser->device->intf->dev, "hid_register_report failed"); > > And in hid_register_field(): > dev_dbg(report->device->intf->dev, "too many fields in report"); Those look right, modulo the missing newlines. > At the same time I'm also wondering if it is safe to assume that > followin the hid->intf->dev is valid when hid_wait_io() is called from > the outside. I suspect that should just be declared "static". > I'm completely new in this area, so I'm really clueless, and any > clarifications or hint/tips are very much appreciated. I'd very much > like to know wether I'm on the right track here ;-) Looks like it so far. Maybe Vojtech will have some additional suggestions. - Dave > > Warm regards, > Mark. > ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ linux-usb-devel@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel