Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 621162 Details for
Bug 862915
KVM USB passthrough - usb device initiated reset causes device to disappear in guest
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
Send command to IguanaWorks USB device to reset/reboot itself
igreset.c (text/x-csrc), 2.62 KB, created by
Sean Young
on 2012-10-03 21:11:06 UTC
(
hide
)
Description:
Send command to IguanaWorks USB device to reset/reboot itself
Filename:
MIME Type:
Creator:
Sean Young
Created:
2012-10-03 21:11:06 UTC
Size:
2.62 KB
patch
obsolete
> >#include <stdio.h> >#include <stdlib.h> >#include <stdint.h> >#include <limits.h> >#include <libusb-1.0/libusb.h> > > >struct iguanair { > uint16_t version; > uint8_t features; > uint8_t cycles; > libusb_device_handle *device; > const struct libusb_endpoint_descriptor *ep_in, *ep_out; >}; > >static int get_version(struct iguanair *ir) >{ > static uint8_t get_version[4] = { 0, 0, 0xcd, 0x01 }; > int transferred, rc; > > rc = libusb_interrupt_transfer(ir->device, ir->ep_out->bEndpointAddress, > get_version, 4, &transferred, 1000); > if (rc) return rc; > > uint8_t answer[8]; > > rc = libusb_interrupt_transfer(ir->device, ir->ep_in->bEndpointAddress, > answer, 8, &transferred, 1000); > > if (rc) return rc; > if (transferred != 6) return LIBUSB_ERROR_IO; > > ir->version = answer[5] << 8 | answer[4]; > > printf("version: %x\n", ir->version); > > if (!(ir->version & 0xff) || !(ir->version & 0xff00)) { > ir->features = 0xff; > return 0; > } > > static uint8_t get_features[4] = { 0, 0, 0xcd, 0x10 }; > > rc = libusb_interrupt_transfer(ir->device, ir->ep_out->bEndpointAddress, > get_features, 4, &transferred, 1000); > if (rc) return rc; > > rc = libusb_interrupt_transfer(ir->device, ir->ep_in->bEndpointAddress, > answer, 8, &transferred, 1000); > > if (rc) return rc; > if (transferred < 5) return LIBUSB_ERROR_IO; > > ir->features = answer[4]; > ir->cycles = transferred > 5 ? answer[5] : 0; > > return 0; >} > >static int do_resetsend(struct iguanair *ir) >{ > int rc, transferred; > uint8_t reset[4] = { 0, 0, 0xcd, 0xff }; > > rc = libusb_interrupt_transfer(ir->device, > ir->ep_out->bEndpointAddress, reset, sizeof(reset), > &transferred, 1000); > return rc; >} > >int main(int argc, char *argv[]) >{ > struct iguanair ir; > int rc; > libusb_device_handle *device; > libusb_context *libusb; > libusb_device *dev; > struct libusb_config_descriptor *config; > const struct libusb_interface_descriptor *interface; > > libusb_init(&libusb); > > device = libusb_open_device_with_vid_pid(libusb, 0x1781, 0x0938); > if (!device) { > printf("usb: device not found\n"); > exit(EXIT_FAILURE); > } > > rc = libusb_set_configuration(device, 1); > //if (rc) printf("usb_set_configuration: %s\n", libusb_error_name(rc)); > rc = libusb_claim_interface(device, 0); > //if (rc) printf("usb_claim_interface: %s\n", libusb_error_name(rc)); > > dev = libusb_get_device(device); > libusb_get_config_descriptor(dev, 0, &config); > > interface = &config->interface[0].altsetting[0]; > > if (interface->bNumEndpoints < 2) { > printf("usb: device not found\n"); > exit(EXIT_FAILURE); > } > > ir.device = device; > ir.ep_in = &interface->endpoint[0]; > ir.ep_out = &interface->endpoint[1]; > > get_version(&ir); > do_resetsend(&ir); > > libusb_exit(libusb); > > return 0; >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 862915
: 621162 |
781757