Modify

Opened 6 years ago

Closed 5 years ago

Last modified 22 months ago

#10394 closed enhancement (invalid)

USB reset

Reported by: Sebastian.Prengel@… Owned by: jow
Priority: normal Milestone: Barrier Breaker 14.07
Component: packages Version: Trunk
Keywords: Cc:

Description

Hello OpenWrt,

While playing with usb hdd and auto mount I am missing one very helpful feature - USB reset / USB re-enumeration! There is a function in libusb called usb_reset and a piece of c-code here:

from Alan Stern
*/

#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/ioctl.h>

#include <linux/usbdevice_fs.h>

int main(int argc, char argv)
{

const char *filename;
int fd;
int rc;

if (argc != 2) {

fprintf(stderr, "Usage: usbreset device-filename\n");
return 1;

}
filename = argv[1];

fd = open(filename, O_WRONLY);
if (fd < 0) {

perror("Error opening output file");
return 1;

}

printf("Resetting USB device %s\n", filename);
rc = ioctl(fd, USBDEVFS_RESET, 0);
if (rc < 0) {

perror("Error in ioctl");
return 1;

}
printf("Reset successful\n");

close(fd);
return 0;

}

Can anyone make a package out of it?

Thanks in advance
Sebastian

Attachments (0)

Change History (8)

comment:1 Changed 6 years ago by jow

  • Owner changed from developers to jow
  • Status changed from new to accepted

comment:2 Changed 6 years ago by jow

  • Resolution set to fixed
  • Status changed from accepted to closed

Added in r29611 - thanks!

comment:3 Changed 5 years ago by anonymous

  • Resolution fixed deleted
  • Status changed from closed to reopened

Missing in AA-RC1 (r34185)

comment:4 Changed 5 years ago by jow

  • Resolution set to worksforme
  • Status changed from reopened to closed

comment:5 Changed 5 years ago by cs

hi

unable to reset my usb hd after warm boot:

root@cs-knoten2-rspro:~# usbreset
Usage:

usbreset PPPP:VVVV - reset by product and vendor id
usbreset BBB/DDD - reset by bus and device number
usbreset "Product" - reset by product name

Devices:

Number 001/001 ID 1d6b:0002 Atheros AR71xx built-in EHCI controller
Number 001/004 ID 05e3:0723 USB 05e3:0723Storage

root@cs-knoten2-rspro:~# usbreset 001/001
Resetting Atheros AR71xx built-in EHCI controller ... failed [Is a directory]
root@cs-knoten2-rspro:~# usbreset 1d6b:0002
Resetting Atheros AR71xx built-in EHCI controller ... failed [Is a directory]

reset of 05e3:0723 has no effect

it is a routerstationpro

cs

comment:6 Changed 5 years ago by anonymous

  • Resolution worksforme deleted
  • Status changed from closed to reopened

reopen

comment:7 Changed 5 years ago by jow

  • Resolution set to invalid
  • Status changed from reopened to closed

The "Is a directory" error is normal when using usb reset on root hubs. Also this ticket is about adding a package, and the package was added so why reopen the ticket.

"reset of 05e3:0723 has no effect" is a way too vague problem description.

comment:8 Changed 4 years ago by jow

  • Milestone changed from Attitude Adjustment 12.09 to Barrier Breaker 14.07

Milestone Attitude Adjustment 12.09 deleted

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.