2017-11-03 18:28:30 +08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2005-04-17 06:20:36 +08:00
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* usbdevice_fs.h -- USB device file system.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2000
|
|
|
|
* Thomas Sailer (sailer@ife.ee.ethz.ch)
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
*
|
|
|
|
* History:
|
|
|
|
* 0.1 04.01.2000 Created
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
#ifndef _LINUX_USBDEVICE_FS_H
|
|
|
|
#define _LINUX_USBDEVICE_FS_H
|
|
|
|
|
2012-10-13 17:46:48 +08:00
|
|
|
#include <uapi/linux/usbdevice_fs.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
#ifdef CONFIG_COMPAT
|
2005-09-03 17:27:08 +08:00
|
|
|
#include <linux/compat.h>
|
2009-11-14 09:28:05 +08:00
|
|
|
|
|
|
|
struct usbdevfs_ctrltransfer32 {
|
|
|
|
u8 bRequestType;
|
|
|
|
u8 bRequest;
|
|
|
|
u16 wValue;
|
|
|
|
u16 wIndex;
|
|
|
|
u16 wLength;
|
|
|
|
u32 timeout; /* in milliseconds */
|
|
|
|
compat_caddr_t data;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct usbdevfs_bulktransfer32 {
|
|
|
|
compat_uint_t ep;
|
|
|
|
compat_uint_t len;
|
|
|
|
compat_uint_t timeout; /* in milliseconds */
|
|
|
|
compat_caddr_t data;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct usbdevfs_disconnectsignal32 {
|
|
|
|
compat_int_t signr;
|
|
|
|
compat_caddr_t context;
|
|
|
|
};
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
struct usbdevfs_urb32 {
|
|
|
|
unsigned char type;
|
|
|
|
unsigned char endpoint;
|
|
|
|
compat_int_t status;
|
|
|
|
compat_uint_t flags;
|
|
|
|
compat_caddr_t buffer;
|
|
|
|
compat_int_t buffer_length;
|
|
|
|
compat_int_t actual_length;
|
|
|
|
compat_int_t start_frame;
|
|
|
|
compat_int_t number_of_packets;
|
|
|
|
compat_int_t error_count;
|
|
|
|
compat_uint_t signr;
|
|
|
|
compat_caddr_t usercontext; /* unused */
|
2020-02-20 21:20:17 +08:00
|
|
|
struct usbdevfs_iso_packet_desc iso_frame_desc[];
|
2005-04-17 06:20:36 +08:00
|
|
|
};
|
[PATCH] usb: Patch for USBDEVFS_IOCTL from 32-bit programs
Dell supplied me with the following test:
#include<stdio.h>
#include<errno.h>
#include<sys/ioctl.h>
#include<fcntl.h>
#include<linux/usbdevice_fs.h>
main(int argc,char*argv[])
{
struct usbdevfs_hub_portinfo hubPortInfo = {0};
struct usbdevfs_ioctl command = {0};
command.ifno = 0;
command.ioctl_code = USBDEVFS_HUB_PORTINFO;
command.data = (void*)&hubPortInfo;
int fd, ret;
if(argc != 2) {
fprintf(stderr,"Usage: %s /proc/bus/usb/<BusNo>/<HubID>\n",argv[0]);
fprintf(stderr,"Example: %s /proc/bus/usb/001/001\n",argv[0]);
exit(1);
}
errno = 0;
fd = open(argv[1],O_RDWR);
if(fd < 0) {
perror("open failed:");
exit(errno);
}
errno = 0;
ret = ioctl(fd,USBDEVFS_IOCTL,&command);
printf("IOCTL return status:%d\n",ret);
if(ret<0) {
perror("IOCTL failed:");
close(fd);
exit(3);
} else {
printf("IOCTL passed:Num of ports %d\n",hubPortInfo.nports);
close(fd);
exit(0);
}
return 0;
}
I have verified that it breaks if built in 32 bit mode on x86_64 and that
the patch below fixes it.
Signed-off-by: Pete Zaitcev <zaitcev@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-10-18 09:15:54 +08:00
|
|
|
|
|
|
|
struct usbdevfs_ioctl32 {
|
|
|
|
s32 ifno;
|
|
|
|
s32 ioctl_code;
|
|
|
|
compat_caddr_t data;
|
|
|
|
};
|
2005-04-17 06:20:36 +08:00
|
|
|
#endif
|
|
|
|
#endif /* _LINUX_USBDEVICE_FS_H */
|