# USB Audio firmware load



## laufdi (Apr 7, 2013)

Since yesterday my M-Audio Transit USB soundcard won't work anymore

On the attempt to upload the firmware I get

```
# /usr/local/bin/dfu-util -R -t 64 -d 0x0763:0x2806 -D /usr/local/share/maudio/ma006101.bin
dfu-util 0.7

Copyright 2005-2008 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2012 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to dfu-util@lists.gnumonks.org

Filter on vendor = 0x0763 product = 0x2806
Opening DFU capable USB device... ID 0763:2806
Deducing device DFU version from functional descriptor length
Run-time device DFU version 0100
Claiming USB DFU Runtime Interface...
Determining device status: state = dfuIDLE, status = 0
WARNING: Runtime device already in DFU state ?!?
Found Runtime: [0763] devnum=0, cfg=1, intf=0, alt=0, name="RAM"
Claiming USB DFU Interface...
Cannot claim interface
```

even if devd is not running after plugin*.*

FreeBSD 9.1-STABLE #20


trying madfuload like linux:


```
> madfuload  -D /dev/usb/0.5.0 -f /usr/local/share/maudio/ma006100.bin -v -3
/usr/local/share/maudio/ma006100.bin: 5616 bytes read successfully
reading device descriptor ...
ioctl failed: (5) Input/output error
ioctl failed: (5) Input/output error
ioctl failed: (5) Input/output error
ioctl failed: (5) Input/output error
...
timeout failed: (6) Device not configured
ioctl failed: (6) Device not configured
timeout failed: (6) Device not configured
ioctl failed: (6) Device not configured
timeout failed: (6) Device not configured
ioctl failed: (6) Device not configured
timeout failed: (6) Device not configured
ioctl failed: (6) Device not configured
...
```


----------



## hselasky@ (Apr 8, 2013)

Hi,

Try not using the -R option. Else edit the source code and make it continue after the above mentioned error. It is harmless.

--HPS


----------



## laufdi (Apr 8, 2013)

Thanks for the reply, I tried harder now and got past the error. After flashing it wants to milli_sleep dst.bwPollTimeout which is 2097152, had to skip that too.

Now I get a device! But `usbconfig` still says 

```
ugen0.5: <Unknown Unknown> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (200mA)
```

And I have to use the -R switch to get the device


```
...
Run-time device DFU version 0100
Claiming USB DFU Runtime Interface...
Determining device status: state = dfuIDLE, status = 0
WARNING: Runtime device already in DFU state ?!?
Found Runtime: [0763] devnum=0, cfg=1, intf=0, alt=0, name="RAM"
Claiming USB DFU Interface...
Cannot claim interface -6
Continuing anyway
Setting Alternate Setting #0 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
Deducing device DFU version from functional descriptor length
DFU mode device DFU version 0100
No valid DFU suffix signature
Warning: File has no DFU suffix
bytes_per_hash=116
Copying data from PC to DFU device
Starting download: [##################################################] finished!
Sent a total of 5803 bytes
state(7) = dfuMANIFEST, status(0) = No error condition is present
state(2) = dfuIDLE, status(0) = No error condition is present
Done!
```


```
uaudio0: <Transit USB> on usbus0
uaudio0: Play: 96000 Hz, 2 ch, 24-bit S-LE PCM format, 2x8ms buffer.
uaudio0: Record: 96000 Hz, 2 ch, 24-bit S-LE PCM format, 2x8ms buffer.
uaudio0: No MIDI sequencer.
pcm6: <USB audio> on uaudio0
uaudio0: No HID volume keys found.
```

on [cmd=]usbconfig -d ugen0.5 reset[/cmd] I get new kernel messages about the device, but still not the correct info in `usbconfig`.

I cannot play music, only white noise. Can't switch sample rate.

Bottom line: *the thing is probably strangely broken*. On Windows I can switch samplerate which is even detected by external DAC, but have no sound device and thus cannot play anything.

Can anyone suggest another device for optical S/PDIF output via USB?


----------



## laufdi (Aug 3, 2013)

No, the device is not broken. I got another one and both work on Windows and behave like above on FreeBSD.


----------



## hselasky@ (Aug 4, 2013)

Did you try to use dfu-util under Linux? Does it work there? What tools are you using to flash the firmware?

Also, the image you are trying to flash using DFU-util does not have a valid signature and is not meant to be flashed using DFU-UTIL.


```
DFU mode device DFU version 0100
No valid DFU suffix signature
Warning: File has no DFU suffix
bytes_per_hash=116
```

You could try to `dfu-encode` your image first.

BTW: There is a new version of DFU-UTIL more suitable for FreeBSD:


```
git clone git://gitorious.org/dfu-util/dfu-util.git
git checkout hps-rewrite

cd hps-rewrite/src
cc -o dfu-util -lusb -DPACKAGE_STRING='""' -DPACKAGE_BUGREPORT='""' -DHAVE_NANOSLEEP -DHAVE_FTRUNCATE dfu.c dfu_file.c dfu_load.c dfuse.c dfuse_mem.c main.c dfu_util.c quirks.c
```
--HPS


----------



## hselasky@ (Aug 4, 2013)

The madfuload utility does not work under FreeBSD, because it uses the wrong USB API!

http://usb-midi-fw.cvs.sourceforge....irmware/madfuload.c?revision=1.12&view=markup

Ask Clemens L. (listed as author of medfuload.c) to port it to LibUSB v0.1 or 1.0 using the synchronous USB API.

--HPS


----------



## laufdi (Aug 5, 2013)

hselasky said:
			
		

> BTW: There is a new version of DFU-UTIL more suitable for FreeBSD:
> 
> 
> ```
> ...


Same result with that



```
./src/dfu-util -R -t 64 -d 0x0763:0x2806 -D /usr/local/share/maudio/ma006100.bin 


Copyright 2005-2008 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2012 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to 

Deducing device DFU version from functional descriptor length
Opening DFU capable USB device...
ID 0763:2806
Run-time device DFU version 0100
Claiming USB DFU Runtime Interface...
Determining device status: state = dfuIDLE, status = 0
dfu-util: WARNING: Runtime device already in DFU state ?!?
```

I've lost all the hacks I did to it before and I don't want to do that again ...


----------

