fatso83 / casio-wmp1

Software for file management on the classic Casio WMP-1 watch
7 stars 3 forks source link

Return -32. can't write bulk write control message. #3

Open robertalks opened 6 years ago

robertalks commented 6 years ago

Hello, just started to use your code, but doesn't seem to work for me. Using openSUSE 42.3 and kernel 4.16.2-1.g7b2d22b-default and getting this messages from the kernel:

[23735.371260] usb 1-2: USB disconnect, device number 4
[23748.521739] usb 1-2: new full-speed USB device number 5 using xhci_hcd
[23748.678750] usb 1-2: New USB device found, idVendor=07cf, idProduct=3801
[23748.678757] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[23748.678762] usb 1-2: Product: CASIO USB Watch Dongle
[23748.678765] usb 1-2: Manufacturer: CASIO COMPUTER CO.,LTD.
[23785.143594] usb 1-2: usbfs: interface 0 claimed by usbfs while 'wmp_manager' sets config #1
[24115.915610] usb 1-2: usbfs: interface 0 claimed by usbfs while 'wmp_manager' sets config #1 
[24264.753108] usb 1-2: usbfs: interface 0 claimed by usbfs while 'wmp_manager' sets config #1

Any help would be greatly appreciated.

robertalks commented 6 years ago

Figured out the issue, but writing now files to the device, fails:

Casio WMP-1 Manager v0.1 by Florian Schmidt (schmidt_florian at gmx.de)
(based on Casio WMP-1 MMPORT Driver v1.0 - by Jimi)

4 files. total size: 13.26MB. estimated time: 05:07.1s
deleting existing tracks
 0.0% (eta: 05:07.1s) reading 01._Frank_Sinatra_-_Strangers_In_The_Night.mp3...found ID3v2 header!
got total id3v2 size of 224559 bytes
size: 2453kB eta: 55s...sending...toc...usb_vendor_message_out(): Broken pipe
return value: -32
can't write bulk write control message
done
19.7% (eta: 00:22.3s) reading 02._Frank_Sinatra_-_I've_Got_You_Under_My_Skin.mp3...found ID3v2 header!
got total id3v2 size of 224563 bytes
size: 3478kB eta: 7s...sending...usb_vendor_message_out(): Broken pipe
return value: -32
can't write bulk write control message
error uploading file.
46.9% (eta: 00:14.7s) reading 04._Frank_Sinatra_-_My_Way.mp3...found ID3v2 header!
got total id3v2 size of 224543 bytes
size: 4281kB eta: 9s...sending...usb_vendor_message_out(): Broken pipe
return value: -32
can't write bulk write control message
error uploading file.
80.1% (eta: 00:05.5s) reading 05._Frank_Sinatra_-_Somethin'_Stupid.mp3...found ID3v2 header!
got total id3v2 size of 224553 bytes
size: 2486kB eta: 5s...sending...usb_vendor_message_out(): Broken pipe
return value: -32
can't write bulk write control message
error uploading file.
fatso83 commented 6 years ago

@robertalks Hi, thanks for taking the time to report this! Funny to know the number of known users might be approaching 4 :joy:

I have never tried compiling this on Open Suse, but I don't see why it shouldn't work ...

To dig into this I need to be able to reproduce it somehow. As I recently was moving, a lot of my stuff is in storage, including the wmp1, so I might not be able to get to this in a week or two.

I will start with trying to get it working on Ubuntu, since that is the last known working target. It used to work on Slackware and Suse back in 2005 (and Ubuntu in 2015) ...

By the way, you are using the right version of the libs? Although I know the newer libusb library has a compatibility layer to the old 0.1 libusb, I seem to recall it didn't work (my memory might fail me, though). If you are using that, I would try to get hold of the old library (libusb 0.1) for Suse, perhaps building it from scratch if it's not available on OpenSuse.

I would also try running it as sudo, just to rule out permissions.

If everything is the same, except our kernel versions, we can start looking deeper. But the easy options first :-)

fatso83 commented 6 years ago

The original 0.1 library source can be downloaded here or here.

fatso83 commented 6 years ago

Hi, @robertalks. I just searched for that exact error and guess what ... my name came up in this 2013 thread, which was about getting it working on OS X using the libusb-compat lib. Is this the same issue?

I "solved" it at that time by just using the original library on a Linux VM (quicker than figuring out usb programming).

robertalks commented 6 years ago

Hi, this is what is available on openSUSE and what I have installed:

robert@pandora:~> rpm -qa|grep -i libusb libusb-0_1-4-0.1.13-34.3.x86_64 libusb-1_0-devel-1.0.20-5.5.x86_64 libusb-1_0-0-1.0.20-5.5.x86_64 libusbredirparser1-0.7-3.3.x86_64 libusb-compat-devel-0.1.5-34.3.x86_64 libusbredirhost1-0.7-3.3.x86_64 libusbmuxd4-1.0.10-7.1.x86_64

robertalks commented 6 years ago

Alright, took your advice and build libusb from those sources and installed them in /opt/libusb (to not damage my machine). Rebuild your code with modification to the Makefile:

wmp_manager: casio_wmp.cpp usb_layer.cpp g++ -o wmp_manager casio_wmp.cpp usb_layer.cpp -L/opt/libusb/lib64 -lusb -I/opt/libusb/include

and ran the binary with:

+ export LD_LIBRARY_PATH=/opt/libusb/lib64: + LD_LIBRARY_PATH=/opt/libusb/lib64: + ldd ./wmp_manager linux-vdso.so.1 (0x00007fff42629000) libusb-0.1.so.4 => /opt/libusb/lib64/libusb-0.1.so.4 (0x00007f74d3439000) libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00007f74d30b0000) libm.so.6 => /lib64/libm.so.6 (0x00007f74d2db3000) libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f74d2b9c000) libc.so.6 => /lib64/libc.so.6 (0x00007f74d27f7000) /lib64/ld-linux-x86-64.so.2 (0x00007f74d3642000) + ./wmp_manager -a play.m3u Casio WMP-1 Manager v0.1 by Florian Schmidt (schmidt_florian at gmx.de) (based on Casio WMP-1 MMPORT Driver v1.0 - by Jimi)

usb_vendor_message_in(): Broken pipe return value: -32 Error: can't read mmc_id - is the cradle closed? robert@pandora:~/output> sudo ./casio.sh

Watch needs to connect to dongle...done. Connected, waiting for watch to settle.......................done. 4 files. total size: 13.26MB. estimated time: 05:07.1s 0.0% (eta: 05:07.1s) reading 01._FrankSinatra-_Strangers_In_The_Night.mp3...found ID3v2 header! got total id3v2 size of 224559 bytes size: 2453kB eta: 55s...sending...bulk write failed error uploading file. 19.7% (eta: 04:06.7s) reading 02._FrankSinatra-_I've_Got_You_Under_My_Skin.mp3...found ID3v2 header! got total id3v2 size of 224563 bytes size: 3478kB eta: 79s...sending...usb_vendor_message_out(): Broken pipe return value: -32 can't write bulk write control message error uploading file. 46.9% (eta: 02:43.0s) reading 04._FrankSinatra-_My_Way.mp3...found ID3v2 header! got total id3v2 size of 224543 bytes size: 4281kB eta: 97s...sending...usb_vendor_message_out(): Broken pipe return value: -32 can't write bulk write control message error uploading file. 80.1% (eta: 01:01.2s) reading 05._FrankSinatra-_Somethin'_Stupid.mp3...found ID3v2 header! got total id3v2 size of 224553 bytes size: 2486kB eta: 56s...sending...usb_vendor_message_out(): Broken pipe return value: -32 can't write bulk write control message error uploading file. writing toc...usb_vendor_message_out(): Broken pipe return value: -32 can't write bulk write control message done`

robertalks commented 6 years ago

Also:

robert@pandora:~/output> /opt/libusb/bin/libusb-config --version 0.1.12

fatso83 commented 6 years ago

@robertalks Hmm ... sorry to see that didn't work! Not quite sure what to do next ... Maybe it's finally time I looked into rewaking those C skills from university a decade ago and try changing the code made by Florian into using libusb-1.0.x? That would probably make getting help from the mailing list a lot easier.

fatso83 commented 6 years ago

@robertalks I don't have a bug fix right now, but as a workaround I can suggest something that will at least make it possible to use your WMP right now:

Yes, it's a hack, but at least you won't need to wait for me to learn USB programming ...

robertalks commented 6 years ago

Alright, will try that.

robertalks commented 6 years ago

Alright, so did the setup using VirtualBox and Ubuntu 12.04.5, but I can't really see the USB device, the Casio to allow the VM to work with it. So this doesn't work eider. I can see 'No USB devices connected'.

Could this issue be more related to USB 3.0 <-> USB 2.0 ?

robert@pandora:~> lsusb|grep Casio Bus 001 Device 018: ID 07cf:3801 Casio Computer Co., Ltd WMP-1 MP3-Watch

You can see the usb device on the host, but VirtualBox doesn't see it at all.

fatso83 commented 6 years ago

Are you sure you told VirtualBox to let Ubuntu access your USB devices explicitly? For instance, you need the extension pack. These articles both tell you how:

robertalks commented 6 years ago

Ahh, I don't think you understood, is not that I don't know how, its not working.

robertalks commented 6 years ago

I actually tied to attach a USB stick and same issue. Not sure what is the problem, the kernel or the machine or VirtualBox.

robertalks commented 6 years ago

Nevermind, the permissions on the user was wrong :)

robertalks commented 6 years ago

Alright, so finally I was able to use Ubuntu 12.04, but trying to write to the device ends up in the exact same errors as on openSUSE.

fatso83 commented 6 years ago

Ah ... that is frustrating. I am sorry to have sent you down that rabbit hole for nothing, but I know it used to work. I'm picking up my device from storage next week, so maybe I am able to dig into it. Since this issue seems to show the same characteristics as #1, I suspect fixing this will make it work cross-platform, which would be cool. If there is any progress, I'll let you know.

robertalks commented 6 years ago

Don't worry, its a pleasure for me. Haven't played with this things for ages. Trying now Windows XP in VirtualBox, see if it makes a difference :)

fatso83 commented 6 years ago

Good to hear. I was in storage today and actually managed to locate all the bits. I see that something needs to be done. Results using 64 bit version of Ubuntu 18.04.1:

[206624.446010] usb 1-1.2: usbfs: interface 0 claimed by usbfs while 'wmp_manager' sets config #1
[206634.377561] usb 1-1.2: USB disconnect, device number 5
[206637.158868] usb 1-1.2: new full-speed USB device number 6 using ehci-pci
[206637.275941] usb 1-1.2: New USB device found, idVendor=07cf, idProduct=3801
[206637.275947] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[206637.275950] usb 1-1.2: Product: CASIO USB Watch Dongle
[206637.275953] usb 1-1.2: Manufacturer: CASIO COMPUTER CO.,LTD.

$ sudo ./wmp_manager 
Casio WMP-1 Manager v0.1 by Florian Schmidt (schmidt_florian at gmx.de)
(based on Casio WMP-1 MMPORT Driver v1.0 - by Jimi)

usb_vendor_message_in(): Broken pipe
return value: -32
usb_vendor_message_in(): Broken pipe
return value: -32
Error: can't read mmc_id - is the cradle closed?

carlerik at diffia9350 in ~/dev/casio-wmp1/src (master)
$ sudo ./wmp_manager 
Casio WMP-1 Manager v0.1 by Florian Schmidt (schmidt_florian at gmx.de)
(based on Casio WMP-1 MMPORT Driver v1.0 - by Jimi)

setting configuration...
Error: Failed to setup device

I know the USB is a bit faulty on this computer, so perhaps that might be it, but I'll need to check with another pc as well to make sure. Anyway: research will follow.