vuori / linux-minidisc

Free software for accessing MiniDisc devices (fork with NetMD fixes—use upstream for HiMD devices)
GNU General Public License v2.0
45 stars 9 forks source link

netmdcli commands dont seem permanent. #2

Closed brenthuisman closed 5 years ago

brenthuisman commented 5 years ago

I've been playing a bit with netmdcli but none of my command seems to be 'permanent', even if the -v flag indicates something might be happening. For instance, I'm trying to wipe an MD in order to move some new files onto it:

''' [13:09:05 last:0s ~/linux-minidisc/netmdcli] ./netmdcli Net MD Walkman Raw title: Tryntje Oosterhuis for once in my life Disc Title: Tryntje Oosterhuis for once in my life

Track 0: UnPROT UNKNOWN - 00:47:56 - You will know Track 1: UnPROT UNKNOWN - 04:00:23 - I wish Track 2: UnPROT UNKNOWN - 04:04:69 - I was made to love him Track 3: UnPROT UNKNOWN - 03:48:37 - Pastime paradise Track 4: UnPROT UNKNOWN - 03:37:31 - Don't you worry 'bout a thing Track 5: UnPROT UNKNOWN - 02:37:44 - Lately Track 6: UnPROT UNKNOWN - 01:30:48 - Overjoyed Track 7: UnPROT UNKNOWN - 03:17:60 - For once in my life Track 8: UnPROT UNKNOWN - 05:01:12 - All i do Track 9: UnPROT UNKNOWN - 05:05:42 - Higher grond Track 10: UnPROT UNKNOWN - 05:01:74 - Living for the city Track 11: UnPROT UNKNOWN - 05:30:21 - These 3 words Track 12: UnPROT UNKNOWN - 04:59:04 - Love in need of love today Track 13: UnPROT UNKNOWN - 04:48:48 - Sire Duke Track 14: UnPROT UNKNOWN - 03:14:06 - Signed,Sealed delivered i'm yours Track 15: UnPROT UNKNOWN - 03:28:16 - Superstition Track 16: UnPROT UNKNOWN - 12:42:43 - Do i do Track 17: UnPROT UNKNOWN - 01:24:02 -

--Empty Groups--

[13:09:44 last:0s ~/linux-minidisc/netmdcli] ./netmdcli -v delete 1 17
Net MD Walkman Raw title: Tryntje Oosterhuis for once in my life Disc Title: Tryntje Oosterhuis for once in my life

delete: removing track 17 delete: removing track 16 delete: removing track 15 delete: removing track 14 delete: removing track 13 delete: removing track 12 delete: removing track 11 delete: removing track 10 delete: removing track 9 delete: removing track 8 delete: removing track 7 delete: removing track 6 delete: removing track 5 delete: removing track 4 delete: removing track 3 delete: removing track 2 delete: removing track 1 [13:09:49 last:0s ~/linux-minidisc/netmdcli] ./netmdcli Net MD Walkman Raw title: Tryntje Oosterhuis for once in my life Disc Title: Tryntje Oosterhuis for once in my life

Track 0: UnPROT UNKNOWN - 00:47:56 - You will know Track 1: UnPROT UNKNOWN - 04:00:23 - I wish Track 2: UnPROT UNKNOWN - 04:04:69 - I was made to love him Track 3: UnPROT UNKNOWN - 03:48:37 - Pastime paradise Track 4: UnPROT UNKNOWN - 03:37:31 - Don't you worry 'bout a thing Track 5: UnPROT UNKNOWN - 02:37:44 - Lately Track 6: UnPROT UNKNOWN - 01:30:48 - Overjoyed Track 7: UnPROT UNKNOWN - 03:17:60 - For once in my life Track 8: UnPROT UNKNOWN - 05:01:12 - All i do Track 9: UnPROT UNKNOWN - 05:05:42 - Higher grond Track 10: UnPROT UNKNOWN - 05:01:74 - Living for the city Track 11: UnPROT UNKNOWN - 05:30:21 - These 3 words Track 12: UnPROT UNKNOWN - 04:59:04 - Love in need of love today Track 13: UnPROT UNKNOWN - 04:48:48 - Sire Duke Track 14: UnPROT UNKNOWN - 03:14:06 - Signed,Sealed delivered i'm yours Track 15: UnPROT UNKNOWN - 03:28:16 - Superstition Track 16: UnPROT UNKNOWN - 12:42:43 - Do i do Track 17: UnPROT UNKNOWN - 01:24:02 -

--Empty Groups--

[13:09:51 last:0s ~/linux-minidisc/netmdcli] '''

I hope it is clear what I mean. I first tried the netmdcli command as provided by the Ubuntu 18.04 repo, and then I compiled your fork and tried with that. I also tried as super user. Any idea?

vuori commented 5 years ago

Sounds like the TOC commit isn't happening. NetMD devices seem to be pretty sensitive to timing so this may be a problem with the command being sent too soon after edits. Unfortunately it's difficult to debug without having the device you're using on hand.

Do edits work with Sonicstage?

brenthuisman commented 5 years ago

Unfortunately I don't have Windows so I can't test Sonicstage. It's an N505. Can I delay the toc update command somehow? I willing to test this, because it'll be the only way I get it to work ;)

vuori commented 5 years ago

You can try adding something like sleep(1); at the beginning of function netmd_sync_toc (in libnetmd.c) to see if the problem is timing.

Generally Sonicstage seems to sync a lot more often than libnetmd does so queueing lots of operations in the device TOC cache may be pretty untested in the device firmware.

brenthuisman commented 5 years ago

sleep(0.1) seems to help a lot! After a disc wipe I do get repeated netmd_poll failed until I reconnect the device though, but then it seems to work. I'm filling my first disc now, I'll let you know it anything disastrous happens ;) Would you make this fix permanent or shall I keep it in my own tree for now?

Thanks!

vuori commented 5 years ago

Well, that's still not exactly good. sleep(0.1) will probably result in sleep(0) because that function takes an integer argument, but I guess one system call delay is enough. usleep(100000); should be better.

Poll failed sounds like the device is still left waiting for something, but it's probably going to require snooping Sonicstage to figure out what's going on. Can you try inserting the usleep both at the beginning and end of the sync function and see if that helps any?

brenthuisman commented 5 years ago

After 10 files I got the following error (with the erroneous sleep(0.1)): ''' USB transfer error after 5884416 of 49934360 total bytes (641536 of 1048576 bytes in packet): Input/Output Error netmd_poll: libusb_control_transfer failed netmd_exch_message: netmd_poll failed netmd_secure_send_track failed : Unknown Error netmd_poll: libusb_control_transfer failed netmd_exch_message: netmd_poll failed netmd_poll: libusb_control_transfer failed netmd_exch_message: netmd_poll failed netmd_poll: libusb_control_transfer failed netmd_exch_message: netmd_poll failed netmd_poll: libusb_control_transfer failed netmd_exch_message: netmd_poll failed libusb_get_string_descriptor_asci failed, Resource temporarily unavailable (11) Could not get device name Generic USB error libusb_get_string_descriptor_asci failed, Resource temporarily unavailable (11) Could not get device name Generic USB error libusb_get_string_descriptor_asci failed, Resource temporarily unavailable (11) Could not get device name Generic USB error libusb_get_string_descriptor_asci failed, Resource temporarily unavailable (11) Could not get device name Generic USB error libusb_get_string_descriptor_asci failed, Resource temporarily unavailable (11) Could not get device name Generic USB error '''

I recompiled with usleep, I'll write another disk and report on how that goes.