Re: Reading the frame number field

Danny Budik <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
On Apr 12, 2007, at 6:25 PM, Alan Stern wrote:

> On Thu, 12 Apr 2007, Danny Budik wrote:
>
>> Would it be possible to add my own constant to /usr/include/linux/
>> usbdevice_fs.h and write an underlying function that would call
>> usb_get_current_frame_number()? It
>> looks like I can add a constant say USBDEVFS_FRAMENUM in
>> usbdevice_fs.h, add new case to .../drivers/usb/core/devio.c, add a
>> function called proc_framenum
>> that would call usb_get_current_frame_number() and return the frame
>> number. Is this a reasonable and/or feasible solution?

Below is a patch to do this but I am new to Linux kernel development  
area.  Since this modifies a core usb driver, it's not compiled as a  
module rather into the kernel itself. So, is there a way for me to do  
the following without recompiling the kernel: 1) compile the driver  
by itself and 2) test the functionality of the driver with my user  
space program? Do I have to recompile the whole kernel every time I  
make a modification?
Again I'm a newbie, so if you could point me to a good resource on  
how to do this I'd greatly appreciate it.

Thanks,
Danny


linux-source-2.6.17/drivers/usb/core/devio.c
812a813,826
 > static int proc_getframenum(struct dev_state *ps, void __user *arg)
 > {
 >       int frame_number;
 >       struct usb_device *dev = ps->dev;
 >
 >       frame_number = usb_get_current_frame_number(dev);
 >
 >       if (put_user(frame_number, (int __user *)arg))
 >               return -EFAULT;
 >
 >       return 0;
 >
 > }
 >
1544a1559,1564
 >
 >       case USBDEVFS_GETFRAMENUM:
 >               snoop(&dev->dev, "%s: GETFRAMENUM\n", __FUNCTION__);
 >               ret = proc_getframenum(ps, p);
 >               break;
 >



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.