dfu-programmer: no device present on ubuntu 14.04 (Broken pipe)

Dear all,

I'm trying to flash my Arduino Uno R3 's memory to use it as a USB HID. I'm trying to connect my old Nintento NES controllers via my Arduino to my linux-box to play some old nintendo ROMS with the actuall controllers. Thought I'd show my 5 year old son what daddy used to play with back in the days :-).

However I get stuck running the dfu-programmer tool to upload new firmware. I have made sure the arduino is in DFU mode, (output of lsusb shows "Bus 003 Device 068: ID 03eb:2fef Atmel Corp." for the device). I have found multiple references on the net indicating that at least version 0.6.1 of dfu-programmer should be used to support the "atmega16u2". I've tried using 0.6.1 (default on ubuntu 14.04), and I compiled the lasted version (0.7.2) my self as well as tried using the older version (0.5.4) with applying the patch to support the "atmega16u2". I also tried specifying "at90usb162" instead of atmega16u2, but i keep getting the "no device present" error. I'm running the command via sudo, so that too is not the problem.

Now, i know i can buy an Arduino Leonardo which would solve my problem, but then there's no fun anymore i figuring this one out. Besides, my better half is starting to complain about me running to the electronics shop too often :-).

So, when looking at my syslog, while issuing dfu-programmer commands, I do however get some messages passing by each time I issue a dfu-programmer command :

Sep  6 21:11:41 nibserv kernel: [435836.520726] usb 3-2: reset full-speed USB device number 69 using uhci_hcd
Sep  6 21:11:41 nibserv kernel: [435836.668988] usb 3-2: USB disconnect, device number 69
Sep  6 21:11:41 nibserv kernel: [435836.780620] usb 3-2: new full-speed USB device number 70 using uhci_hcd
Sep  6 21:11:42 nibserv kernel: [435836.947428] usb 3-2: New USB device found, idVendor=03eb, idProduct=2fef
Sep  6 21:11:42 nibserv kernel: [435836.947434] usb 3-2: New USB device strings: Mfr=0, Product=1, SerialNumber=0

indicating that something is happening and the dfu-programmer command is somehow talking to the ATMega chip on the arduino (it also takes a little longer for the command to finish when I supply it with the correct settings, as opposed to e.g. specifying atmega8u2, which is wrong for the Uno R3). So I'm pretty sure it's doing something, however I keep getting the

dfu-programmer: no device present.

errors and cannot erase or flash the new firware to the ATMega.

When i run the dfu-programmer tool with very high debug level it somehow appears that i get a broken pipe when opening the USB device :

sh$ sudo dfu-programmer atmega16u2 dump --debug 10000
     target: atmega16u2
    chip_id: 0x2fef
  vendor_id: 0x03eb
    command: dump
      quiet: false
      debug: 10000
device_type: AVR
------ command specific below ------

dfu.c:387: dfu_device_init( 1003, 12271, 0x7ffca8bbcad0, true, false )
dfu.c:389: dfu_device_init(000003eb, 00002fef)
libusbx: debug [libusb_get_device_list] 
libusbx: debug [discovered_devs_append] need to increase capacity
libusbx: debug [libusb_get_device_descriptor] 
dfu.c:404:  0: 0x0bda, 0x0169
libusbx: debug [libusb_get_device_descriptor] 
dfu.c:404:  1: 0x1d6b, 0x0002
libusbx: debug [libusb_get_device_descriptor] 
dfu.c:404:  2: 0x0763, 0x2010
libusbx: debug [libusb_get_device_descriptor] 
dfu.c:404:  3: 0x1d6b, 0x0001
libusbx: debug [libusb_get_device_descriptor] 
dfu.c:404:  4: 0x1d6b, 0x0001
libusbx: debug [libusb_get_device_descriptor] 
dfu.c:404:  5: 0x046d, 0xc318
libusbx: debug [libusb_get_device_descriptor] 
dfu.c:404:  6: 0x413c, 0x3016
libusbx: debug [libusb_get_device_descriptor] 
dfu.c:404:  7: 0x1d6b, 0x0001
libusbx: debug [libusb_get_device_descriptor] 
dfu.c:404:  8: 0x1d6b, 0x0002
libusbx: debug [libusb_get_device_descriptor] 
dfu.c:404:  9: 0x1d6b, 0x0001
libusbx: debug [libusb_get_device_descriptor] 
dfu.c:404: 10: 0x1d6b, 0x0001
libusbx: debug [libusb_get_device_descriptor] 
dfu.c:404: 11: 0x03eb, 0x2fef
dfu.c:413: found device at USB:3,76
dfu.c:685: dfu_find_interface()
libusbx: debug [libusb_get_config_descriptor] index 0
dfu.c:695: config 0: maxpower=50*2 mA
dfu.c:702: interface 0
dfu.c:711: setting 0: class:254, subclass 1, protocol:2
dfu.c:724: Found DFU Interface: 0
libusbx: debug [libusb_open] open 3.76
libusbx: error [_get_usbfs_fd] libusbx couldn't open USB device /dev/bus/usb/003/076: Broken pipe
libusbx: debug [libusb_open] open 3.76 returns -1
libusbx: debug [libusb_get_device_descriptor] 
dfu.c:404: 12: 0x1d6b, 0x0001
dfu-programmer: no device present.
libusbx: debug [libusb_exit] 
libusbx: debug [libusb_exit] destroying default context

However i can program the arduino just fine, so it' not that it's not working otherwise... And I am running the command as root (I tried both via sudo or really as "root" user).

Any help or pointers to where to look would be highly appreciated (also by my son, though he probably doesn't realize it yet :)) !

Regards,
bino

Ha found it.

Apparently Atmel's DFU firmware is not compatible with recent linux kernel's usbcore autosuspend feature. I found a post on this here : https://sourceforge.net/p/dfu-programmer/mailman/message/504454/ together with a solution.

It works now !