code_junkie

Start program on usb hardware plugin

Nov 13th, 2011
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. foreach (Bus bus in Bus.Busses)
  2. {
  3. Console.WriteLine(bus);
  4. foreach (Descriptor descriptor in bus.Descriptors)
  5. {
  6. Console.WriteLine("t" + descriptor);
  7. try
  8. {
  9. using (Device device = descriptor.OpenDevice())
  10. {
  11. Console.WriteLine("tt Product: " + device.Product);
  12. Console.WriteLine("ttManufacturer: " + device.Manufacturer);
  13. Console.WriteLine();
  14. }
  15. }
  16. catch (UsbException e)
  17. {
  18. Console.WriteLine("Got Exception : " + e);
  19. }
  20. }
  21. }
Add Comment
Please, Sign In to add comment