標題:
Dongle reset
[打印本頁]
作者:
ckleea
時間:
2014-11-7 18:24
標題:
Dongle reset
A script to reset USB dongle
Need to compile the following
resetusb.c
include <stdio.h>
#include <usb.h>
int main(void)
{
struct usb_bus *busses;
usb_init();
usb_find_busses();
usb_find_devices();
busses = usb_get_busses();
struct usb_bus *bus;
int c, i, a;
/* ... */
for (bus = busses; bus; bus = bus->next) {
struct usb_device *dev;
int val;
usb_dev_handle *junk;
for (dev = bus->devices; dev; dev = dev->next) {
char buf[1024];
junk = usb_open ( dev );
usb_get_string_simple(junk,2,buf,1023);
if ( junk == NULL ){
printf("Can't open %p (%s)\n", dev, buf );
} else {
if ((dev->descriptor.idVendor == 0x12d1) && (dev->descriptor.idProduct == 0x1001)) {
printf( "reset %p %d (%s) ", dev, val, buf );
printf( "vendor %x ",dev->descriptor.idVendor);
printf( "product %x\n",dev->descriptor.idProduct);
val = usb_reset(junk);
}
else {
printf( "leave alone %p %d (%s) ", dev, val, buf );
printf( "vendor %x ",dev->descriptor.idVendor);
printf( "product %x\n",dev->descriptor.idProduct);
}
}
usb_close(junk);
}
}
}
複製代碼
Ref:
https://github.com/dirkholz/resetusb/blob/master/src/resetusb.c
作者:
ckleea
時間:
2014-11-7 18:25
Or use the following command
echo "at+cfun=1,1" | atinout - /dev/ttyUSBXX -
where ttyUSBXX is data port.
http://atinout.sourceforge.net
作者:
ckleea
時間:
2014-11-7 18:25
Useful for our Raspberrypi with Dongle
歡迎光臨 電訊茶室 (http://telecom-cafe.com/forum/)
Powered by Discuz! 7.2