> This seemed pretty straight-forward so I thought I'd take a shot at
> implementing this as my first attempt at kernel hacking.

We all had to start somewhere ... :)

>     However, I've
> run into a problem in the user space end of it. In
> /usr/include/asm/types.h, dev_t is defined as 'short'. In
> /usr/include/bits/types.h dev_t is defined as a '_u_quad_t', so the
> usbdevfs_driver_devinfo structure has different sizes in user and kernel
> space. What's the right thing to do?

sixteen bit dev_t ... though I'm puzzled why "_u_quad_t" would
appear anywhere!

> Also, the USB printer module doesn't save its major device number. Is
> just using the value in major.h (USB_CHAR_MAJOR) correct?

I'd use USB_MAJOR from <linux/usb.h>, like printer.c does when
it does the devfs_register() call.

- Dave



> 
> Thanks,
> Allen
> 
> David Brownell wrote:
> > 
> > > Would it be possible (or reasonable) to add an ioctl to usbdevfs which
> > > can ask for this information via the /proc/bus/usb/###/### interface? Or
> > > should the printer.o module execute a user-space helper app to do this
> > > configuration itself?
> > 
> > IMHO, either of those would be reasonable 2.4 solutions.  I'd likely
> > want to see the ioctl, since scenarios have wanted this feature before.
> > But that wouldn't work with non-USB printers; "printer hotplug" should
> > IMHO happen at some point, too.
> > 
> > That is, perhaps adding something like this to <linux/usbdevice_fs.h>
> > 
> >     struct usbdevfs_driver_devinfo {
> >         int        type;        /* S_IFCHR or S_IFBLK from <sys/stat.h> */
> >         dev_t    dev;        /* major/minor */
> >     }
> >     #define USBDEVFS_DRIVER_DEVINFO \
> >         _IOR('U',22, struct usbdevfs_driver_devinfo)
> > 
> > and the driver (printer.c) would get updated
> > 
> >     static int printer_ioctl (
> >         struct usb_device *dev,
> >         unsigned int  ioctl_code,
> >         void *user_data
> >     ) {
> >         switch (ioctl_code) {
> >         case USBDEVFS_DRIVER_DEVINFO:
> >             ... user_data is a struct usbdevfs_driver_devinfo
> >             ... fill it out and return
> >         default:
> >             return -ENOSYS;
> >         }
> >     }
> > 
> >     static struct usb_driver
> >         ...
> >         ioctl: printer_ioctl;
> >     }
> > 
> > Then userspace would call it using the USBDEVFS_IOCTL mechanism.
> > Printer would be the first to start reporting useful info with it.
> > 
> > - Dave
> 
> _______________________________________________
> [EMAIL PROTECTED]
> To unsubscribe, use the last form field at:
> http://lists.sourceforge.net/lists/listinfo/linux-usb-devel


_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
http://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to