On Tue, 30 Aug 2011, Chris Furlough wrote: > OK, hopefully my last couple of questions: > > 1. From the kernel, what's the best way to enumerate the devices that are > already plugged in? Kernel drivers aren't supposed to enumerate devices. But if you insist on it, you can use the bus_for_each_dev routine. > 2. I can use filp_open to open the devices in USBFS, this gives me a struct > file, from which I can get the struct file_operations, from which I can get > a pointer to the IOCTL function for that device. I can cast that as a > function pointer, and call it, but I believe that it's expecting the last > parameter to be a pointer to a buffer in userspace. Is there a correct > way to handle this? The correct way is not to do it at all. There's no good reason for a kernel driver to open a usbfs file. However, if you call set_fs(get_ds()); then the kernel will accept a kernelspace pointer in contexts where it expects a userspace pointer. But be certain to store the original value from get_fs() and restore it before returning to userspace! Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html