Go Back   CVP User Group > Clavinova User Group Discussion Forums > CVP 90- and 100-Series Discussions

CVP 90- and 100-Series Discussions Discussions about CVP 90- and 100-series digital pianos.

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 01-29-2013, 05:23 AM
Dennis Meulensteen's Avatar
Dennis Meulensteen Dennis Meulensteen is offline
Member
 
Join Date: Jan 2003
Location: The Netherlands
Posts: 6
Rep Power: 11
Dennis Meulensteen is starting out
Thumbs up USB Floppy emulator in CVP109; success with Linux

Hi,
wow, this is my first post here in something like ten years! That's insane... has it really been that long?!?

The floppy on my CVP 109 died some time ago and I was looking for a replacement when I recently came across this GOTEK 1000 floppy emulator on e-bay (1.44 MB). Because the price was right (about $30 incl. S&H) and I'd wanted to upgrade to USB for as long as I can remember I just went for it.

I removed the three covered screws off the back of my CVP, slid the top cover forward and there was the floppy assembly, so I carefully pulled the cables out and unscrewed the frame that holds the floppy drive.

The Gotek thingy has a very nice printed circuit board in a crappy plastic case which provides absolutely no electromagnetic shielding so I'll probably have to be wary of cell phones around the piano causing interference... Only time and testing will tell.

The thing actually just worked right from the start! That was a relief and a surprise at the same time because I wasn't impressed with the crappy plastic case. I plugged in a usb key and the CVP prompted me to format the new "floppy" after which I was able to record a midi file and see it on my computer. The only problem was that I could only see the first 'floppy' on my computer. I still needed some sort of method to access the rest.

So much for test one! After this I wanted more, much more. Like 1000 floppies! Yay man I really need 1000 floppies... NOT! But its fun just the same. I grabbed my wife's laptop after she went to bed and launched the included CD to find out how to format 1000 floppies without wearing out my patience. Turns out you just need to insert a USB key while the CVP is powered off and hold the two tiny buttons while powering up. The emulator then rapidly counts from 000 to 999 as it formats 1000 floppies in the time it used to take to format just one! It will format 1000, or as many as your Key will hold, depends on the KEY of course.

Luckily the CVP had no problems accessing these "floppies" so I was a happy man.

Now for the hard part. There are no Linux drivers supplied with this GOTEK emulator and I don't have (or want) Windows on any computer I generally use.

According to the e-bay listing Windows users can use the "UFA1M44-100" formatting software to format 100 floppies which is probably enough for most of us anyway.

So I spent some evenings poking around with a hexadecimal editor and some very dangerous tools such as DD (aka Disk Destroyer)... After a while I discovered how this thing works and was able to write a script to easily access all the virtual floppy images on my USB key. I tested it out with lots of midi files and never had a single hiccup.

Well, there you have it, if anyone is looking for a USB stick to floppy emulator for their CVP 109 then go ahead, I recommend the one I got (from gobuyteam on ebay). Of course, it is only recommended for those who consider themselves able to do such repairs in the first place. If you have a hard time not scratching stuff whenever you have a screw driver in your hands, maybe its best to trick someone else into helping you out, or pay a tech!

I'll post a follow-up tonight so any other Linux based CVP users out there can use my little script.

BTW I have no relation to the people on e-bay who sell this thing or their suppliers etc, as with all hardware hacking, YMMV and I make no warranties express or implied etc etc, you are on your own so have fun!
Reply With Quote
  #2  
Old 01-29-2013, 05:53 AM
dbjorck's Avatar
dbjorck dbjorck is offline
Owner
 
Join Date: May 2004
Location: Copenhagen, Denmark
Posts: 1,829
Rep Power: 125
dbjorck is a name known to alldbjorck is a name known to alldbjorck is a name known to alldbjorck is a name known to alldbjorck is a name known to alldbjorck is a name known to all
Hi!

Nice. Keep following this group, I'm sure your expertise will benefit lots of people!

Brgds

Danny
__________________
Yamaha CVP309-GP
Reply With Quote
  #3  
Old 01-29-2013, 02:31 PM
Dennis Meulensteen's Avatar
Dennis Meulensteen Dennis Meulensteen is offline
Member
 
Join Date: Jan 2003
Location: The Netherlands
Posts: 6
Rep Power: 11
Dennis Meulensteen is starting out
Post Linux script to manage USB fdd emulator images for GOTEK 1000 disk model

I have attached the script I made to manage my own USB key.
This can be used to access any of the disk images located on the USB key by mounting them under /media/usbfdNNN

To use it you need to copy-paste it in an editor and save it in your execution path somewhere then make it executable.
It needs to be run as root but the images can then be accessed by a normal user. This was tailor made for my specific model of floppy emulator (see details in original post) so YMMV - a lot!!!

Examples:
mount some virtual floppy drives located on /dev/sdb:
Code:
#usbfd -m 0 3 9
mount some virtual floppy images on /dev/sdd:
Code:
#usbfd -md /dev/sdd 0 3 9 118 678
Unmount specific images:
Code:
#usbfd -u 3 9
Unmount all images:
Code:
#usbfd -U
etc, etc...

Code:
#!/bin/bash
# usbfd; A utility script to manage multiple floppy images on a single USB stick
# Tested on a GOTEK 1000 floppy model
# v. 0.7 Dennis Meulensteen 2013 dennis@meulensteen.nl -
# This is unsupported software because I don't have the time to provide support
#
#This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.

#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.

#Some variables with default values
TASK="none"
DEVICE="/dev/sdb"
OFFSET=1572864

# Must be root for mounting, so check
if [[ $EUID -ne 0 ]]; then
   echo "You must be root to do this." 1>&2
   exit 100
fi

#handle the options first
while getopts  "muUld:o:" flag; do

#  echo "$flag" $OPTIND $OPTARG

#in order of ascending innocence so innocent options override dangerous ones if someone decides to throw the alphabet at us
  case "$flag" in 
  m) TASK="Mount";;
  u) TASK="UnMount";;
  U) TASK="UnmountAll";;
  l) TASK="List";;
  d) DEVICE=$OPTARG;;
  o) OFFSET=$OPTARG;;

  ?)
    echo "Invalid option."
    echo "Valid Options are:"
    echo "-m to mount one or many images "
    echo "-u to unmount one or many images"
    echo "    if -m or u are used you must provide at least one number between 0 and 999 to mount the respective image(s)."
    echo " -U to unmount all mounted images at once"
    echo " -o NUMBER Provides an offset that corresponds to the distance between the images in bytes (1572864)"
    echo " -d DEVICE to set the device your USB stick is at (/dev/sdb)"
    echo " example: #usbfd -md /dev/sdd 0 3 18"
  ;;

  :)
    echo "Missing argument for $OPTARG"
  ;;
  esac
done
#gets rid of all the complicated switches and their parameters, leaving just the arguments
shift $(($OPTIND - 1))

  case "$TASK" in

  # mount
  "Mount") 
    for FLOP in "$@"
    do
	
	# Check the given file exists #
	if [ -d "/media/usbfd$FLOP" ]
	  then
	    echo "Already mounted, try -u first"
	  else
	    mkdir /media/usbfd$FLOP
	    let MYOFFSET=$OFFSET*$FLOP
	    mount -o loop,offset=$MYOFFSET,users,rw,umask=000 $DEVICE /media/usbfd$FLOP  
	fi
    done
  ;;

  # unmount
  "UnMount") 
    for FLOP in "$@"
    do

      if [ -d "/media/usbfd$FLOP" ]
	then
	  umount /media/usbfd$FLOP
	  rmdir /media/usbfd$FLOP
	else
	  echo "usbfd$FLOP was not mounted."
      fi
    done
  ;;

  # unmount all the usbfd... mounts
  "UnmountAll")
    for dir in /media/usbfd*/
    do
	dir=${dir%*/}
	umount /media/${dir##*/}
	rmdir /media/${dir##*/}
    done
  ;;

  "List")
  echo " Mounted usbfd systems are:"
    for dir in /media/usbfd*/
    do
	if [ $dir!=/media/usbfd*/ ] 
	then
	  echo "$dir"
	fi
    done
  ;;
  esac
Reply With Quote
  #4  
Old 01-31-2013, 02:52 PM
Dennis Meulensteen's Avatar
Dennis Meulensteen Dennis Meulensteen is offline
Member
 
Join Date: Jan 2003
Location: The Netherlands
Posts: 6
Rep Power: 11
Dennis Meulensteen is starting out
Lightbulb Updated the script to v 0.9

Changes: mainly clean up and error handling, testing with ranges and formatting.

Example: format 1000 floppy images on the USB stick in /dev/sdd
Code:
usbfd -fd /dev/sdd {0..999}

usbfd:
Code:
#!/bin/bash
# usbfd; A utility script to manage multiple floppy images on a single USB stick
# Tested on a GOTEK 1000 floppy model
# v. 0.9 Dennis Meulensteen 2013 dennis@meulensteen.nl -
# This is unsupported software because I don't have the time to provide support
#
#This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.

#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.

#Some variables with default values
TASK="none"
DEVICE="/dev/sdb"
DEVICEDEFAULT=1
OFFSET=1572864

# Must be root for mounting, so check
if [[ $EUID -ne 0 ]]; then
   echo "You must be root to do this." 1>&2
   exit 100
fi

#handle the options first
while getopts  "fmuUld:o:" flag; do

#  echo "$flag" $OPTIND $OPTARG

#in order of ascending innocence so innocent options override dangerous ones if someone decides to throw the alphabet at us
  case "$flag" in 
  f) TASK="Format";;
  m) TASK="Mount";;
  u) TASK="UnMount";;
  U) TASK="UnmountAll";;
  l) TASK="List";;
  d) DEVICE=$OPTARG
     DEVICEDEFAULT=0
  ;;
  o) OFFSET=$OPTARG;;

  ?)
    echo "Invalid Option.Usage: usbfd -[OPTIONS] [OPERANDS]"
    echo "Valid Options are:"
    echo "  -m to mount one or many images "
    echo "  -u to unmount one or many images"
    echo "    if -m or u are used you must provide at least one number between 0 and 999 to mount the respective image(s)."
    echo "  -U to unmount all mounted images at once"
    echo "  -o NUMBER Provides an offset that corresponds to the distance between the images in bytes (1572864)"
    echo "  -d DEVICE to set the device your USB stick is at (/dev/sdb)"
    echo "  -f format one or more floppy images (for a minimum of security you must also provide -d [DEVICE])"
    echo "OPERANDS are one or many space seperated whole numers or ranges {N..M} corresponding to images on your USB stick"
    echo "  example of mounting: #usbfd -md /dev/sdd {0..9} 12 18"
    echo "    {N..M} indicates a range of floppy images to operate on, -f and -u also take ranges."
  ;;

  :)
    echo "Missing argument for $OPTARG"
  ;;
  esac
done
#gets rid of all the complicated switches and their parameters, leaving just the arguments
shift $(($OPTIND - 1))

  case "$TASK" in

  "Format") 
    FNAME=$(mktemp) 
    rm $FNAME
    if [ $DEVICEDEFAULT == 1 ]
    then
      echo "Formatting is dangerous! You must explicitly provide a device (-d)"
      exit -1
    fi

    for NUM in "$@"
    do
	FLOP=$(printf %03d ${NUM%})
	# Check the given file exists #
	if [ -d "/media/usbfd$FLOP" ]
	  then
	    echo "usbfd$FLOP is already mounted, try -u first"
	  else 
	    mkfs.msdos -vC $FNAME -n FDISK$FLOP 1440|grep volume #using mkfs repeatedly because of the random volume ids and labels
	    let MYOFFSET=$OFFSET/512*$NUM
	    err=$(dd if=$FNAME of=$DEVICE seek=$MYOFFSET bs=512c count=36 conv=noerror &> /dev/null) || echo "Format failed on disk $FLOP" #only copy what we need
	    rm $FNAME
	fi
    done
  ;;

  # mount
  "Mount") 
    for NUM in "$@"
    do
	FLOP=$(printf %03d ${NUM%})
	# Check the given file exists #
	if [ -d "/media/usbfd$FLOP" ]
	  then
	   echo "usbfd$FLOP is already mounted, try -u first"
	  else
	    mkdir /media/usbfd$FLOP
	    let MYOFFSET=$OFFSET*$NUM
	    mount -o loop,offset=$MYOFFSET,users,rw,umask=000 $DEVICE /media/usbfd$FLOP  
	fi
    done
  ;;

  # unmount
  "UnMount") 
    for NUM in "$@"
    do
      FLOP=$(printf %03d ${NUM%})
      if [ -d "/media/usbfd$FLOP" ]
	then
	  umount /media/usbfd$FLOP
	  rmdir /media/usbfd$FLOP
	else
	  echo "usbfd$FLOP was not mounted."
      fi
    done
  ;;

  # unmount all the usbfd... mounts
  "UnmountAll")
    for dir in /media/usbfd*/
    do
	dir=${dir%*/}
	if [ -d $dir ]
	then
	  umount /media/${dir##*/}
	  rmdir /media/${dir##*/}
	fi
    done
  ;;

  "List")
    for dir in /media/usbfd*/
    do
	dir=${dir%*/}
	if [ -d $dir ] 
	then
	  echo "Mounted: $dir"
	fi
    done
  ;;


  esac
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
CVP 307 Using Disk Orchestra Collection floppy disks New_to_Clavinova_309 CVP 300-Series Discussions 18 11-18-2008 02:42 PM


All times are GMT -5. The time now is 05:26 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
All copyrights reserved - cvpug.com