From: Danny Budik <[EMAIL PROTECTED]> This patch (as899) adds a new ioctl to usbfs: USBDEVFS_GETFRAMENUM. It allows user programs to obtain the current Start-Of-Frame number on a USB bus.
Note that the values returned by the get_frame method in the various host controller drivers are not consistent. They should be adjusted so that they provide the actual frame number as it appears on the bus; that is, a number incrementing by one every millisecond, ranging from 0 to 2047. That will have to be done separately; it interacts with the start_frame values used for submitting Isochronous URBs. Signed-off-by: Alan Stern <[EMAIL PROTECTED]> --- Index: usb-2.6/drivers/usb/core/devio.c =================================================================== --- usb-2.6.orig/drivers/usb/core/devio.c +++ usb-2.6/drivers/usb/core/devio.c @@ -831,6 +831,18 @@ static int proc_getdriver(struct dev_sta return ret; } +static int proc_getframenum(struct dev_state *ps, void __user *arg) +{ + int frame_number; + + frame_number = usb_get_current_frame_number(ps->dev); + if (frame_number < 0) + return frame_number; + if (put_user(frame_number, (int __user *)arg)) + return -EFAULT; + return 0; +} + static int proc_connectinfo(struct dev_state *ps, void __user *arg) { struct usbdevfs_connectinfo ci; @@ -1567,6 +1579,12 @@ static int usbdev_ioctl(struct inode *in snoop(&dev->dev, "%s: IOCTL\n", __FUNCTION__); ret = proc_ioctl_default(ps, p); break; + + case USBDEVFS_GETFRAMENUM: + snoop(&dev->dev, "%s: GETFRAMENUM\n", __FUNCTION__); + ret = proc_getframenum(ps, p); + break; + } usb_unlock_device(dev); if (ret >= 0) Index: usb-2.6/include/linux/usbdevice_fs.h =================================================================== --- usb-2.6.orig/include/linux/usbdevice_fs.h +++ usb-2.6/include/linux/usbdevice_fs.h @@ -173,4 +173,5 @@ struct usbdevfs_ioctl32 { #define USBDEVFS_CLEAR_HALT _IOR('U', 21, unsigned int) #define USBDEVFS_DISCONNECT _IO('U', 22) #define USBDEVFS_CONNECT _IO('U', 23) +#define USBDEVFS_GETFRAMENUM _IOW('U', 24, int) #endif /* _LINUX_USBDEVICE_FS_H */ ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ linux-usb-devel@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel