Hi Alan,

Haruo> Using ioctl (fd, USBDEVFS_RESET, 0), I tested reset. 
Haruo> usb-storage of USB2.0 was successful.
Haruo> When FDD was used in the case of USB1.1, 
Haruo> mount became impossible after reset.
 
Alan> What do you mean?  What does the log show?

I'm sorry. I wrote the following programs.
The execution result is as follows.

[EMAIL PROTECTED] root]# cd ~tomita/usbreset
[EMAIL PROTECTED] usbreset]# ./usbreset 
bus = /proc/bus/usb/001/002
合計 864
-rwxr-xr-x    1 root     root        46481  8月 28 12:05 1.18j1.wks
-rwxr-xr-x    1 root     root        46481  8月 28 12:05 1.18j2.wks
-rwxr-xr-x    1 root     root        46481  8月 28 12:05 1.18j3.wks
-rwxr-xr-x    1 root     root        11829  9月 10 17:30 15.50s.tar.gz
-rwxr-xr-x    1 root     root           16  3月  6  2003 S99zzz
-rwxr-xr-x    1 root     root          914  4月 10 08:58 abort-test.patch
-rwxr-xr-x    1 root     root          938  4月 23  2002 autoftp.bat
-rwxr-xr-x    1 root     root         1412  9月 11 13:28 fdd.txt
-rwxr-xr-x    1 root     root         3703  3月  6  2003 halt
-rwxr-xr-x    1 root     root          378  8月 27 17:57 iozone_test.sh
-rwxr-xr-x    1 root     root        46481  9月  9 08:51 mr518_128MB_1.wks
-rwxr-xr-x    1 root     root        46481  9月  9 08:51 mr518_128MB_2.wks
-rwxr-xr-x    1 root     root        46481  9月  9 08:51 mr518_128MB_3.wks
-rwxr-xr-x    1 root     root        46481  9月  9 14:32 mr518_256MB_1.wks
-rwxr-xr-x    1 root     root        46481  9月  9 14:32 mr518_256MB_2.wks
-rwxr-xr-x    1 root     root        46481  9月  9 14:32 mr518_256MB_3.wks
-rwxr-xr-x    1 root     root        46481  9月  8 16:38 mr518_64MB_1.wks
-rwxr-xr-x    1 root     root        46481  9月  8 16:38 mr518_64MB_2.wks
-rwxr-xr-x    1 root     root        46481  9月  8 16:38 mr518_64MB_3.wks
-rwxr-xr-x    1 root     root       104118  8月 26 02:10 patch-0825
-rwxr-xr-x    1 root     root          759  5月 30 11:38 profile
-rwxr-xr-x    1 root     root        17081  9月  8 20:12 rhn_err1.jpg
-rwxr-xr-x    1 root     root        37151  9月  8 20:12 rhn_err2.jpg
-rwxr-xr-x    1 root     root         1369  9月  8 20:16 rpm.txt
-rwxr-xr-x    1 root     root          345  4月  3 20:15 script_cp.sh
-rwxr-xr-x    1 root     root          859  4月  3 20:16 script_cp_hdd.sh
-rwxr-xr-x    1 root     root          539  4月  5 14:41 script_cp_scsi.sh
-rwxr-xr-x    1 root     root        46481  8月 28 12:06 v2.00.71.wks
-rwxr-xr-x    1 root     root        46481  8月 28 12:06 v2.00.72.wks
-rwxr-xr-x    1 root     root        46481  8月 28 12:06 v2.00.73.wks
usb reset success 1
error: usbdevfs not opend
[EMAIL PROTECTED] usbreset]# 

[EMAIL PROTECTED] root]# mount /dev/sda /mnt/floppy/
/dev/sda: Input/output error
mount: you must specify the filesystem type

---- sample program 

int main(int argc, char **argv);
static int open_usbdevfs(char *bus);

int main(int argc, char **argv)
{
    char bus[22];
    int fd, ret=1, count=0;

    /* make bus name */ 
    snprintf(bus,22,"/proc/bus/usb/001/002");
#ifdef DEBUG
    printf("bus = %s\n", bus);  
#endif /* DEBUG */

    while (1) {
        /* device open */
        if ((fd=open_usbdevfs(bus)) < 0) {
            printf("error: usbdevfs not opend\n");
            ret=0;
            break; 
        }
        
        system("mount /dev/sda /mnt/floppy");
        system("ls -l /mnt/floppy");
        system("umount /dev/sda");
        
        /* device reset */
        ret=ioctl(fd, USBDEVFS_RESET, 0);
        if (ret == -1) {
            printf("error: usbdevfs_reset error %d\n", ret);
            ret = 0;        
            break;
        }
        /* device close */
        close (fd);
        [EMAIL PROTECTED]@sleep(10);
        [EMAIL PROTECTED]@count++;
        printf("usb reset success %d\n", count);                
    }

    if (fd)
        close(fd);
    
    return 1;
}

static int open_usbdevfs(char *bus) {
    int fd;

    fd = open(bus, O_RDWR);
    if (fd < 0)
        return -1;

    return fd;
}

--
Haruo


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to