CBMSTUFF FORUM

Full Version: C code for accessing the SCP hardware
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Keir Fraser has updated his Disk Utilities package to support the SCP hardware. If you are interested in getting ahold of some working C source code for accessing the SCP hardware, Keir has made his Disk Utilities package open source and it can be found here:

https://github.com/keirf/Disk-Utilities

You should be able to drop in the scp.c, scp_dump.c, and scp.h files into any project and modify them as needed.

Thanks Keir for providing this!
Disk-Utilities now works with Mac OS X (10.10.2)

1. Download FTDI drivers here and install: http://www.ftdichip.com/Drivers/VCP.htm

2. Download Disk-Utilities and compile:
git clone https://github.com/keirf/Disk-Utilities.git

Personally I had to comment out some code and change default USB serial device like this:
diff -urN ../GIT/Disk-Utilities/libdisk/container/imd.c ./libdisk/container/imd.c
--- ../GIT/Disk-Utilities/libdisk/container/imd.c 2015-02-20 11:17:24.000000000 +0100
+++ ./libdisk/container/imd.c 2015-02-20 11:57:52.000000000 +0100
@@ -234,11 +234,11 @@
if ((thdr.mode == 0xff) || !ti->nr_sectors)
continue;

- if (ti->nr_sectors >= 256) {
+ /* if (ti->nr_sectors >= 256) {
warnx("T%u.%u: Unexpected number of IBM-MFM sectors (%u)",
cyl(trk), hd(trk), ti->nr_sectors);
continue;
- }
+ } */

retrieve_ibm_mfm_track(
d, trk, &secs, &cyls, &heads, &nos, &marks, &dat);
diff -urN ../GIT/Disk-Utilities/scp/scp_dump.c ./scp/scp_dump.c
--- ../GIT/Disk-Utilities/scp/scp_dump.c 2015-02-20 11:17:24.000000000 +0100
+++ ./scp/scp_dump.c 2015-02-20 11:59:34.000000000 +0100
@@ -21,7 +21,8 @@
#include <libdisk/util.h>
#include "scp.h"

-#define DEFAULT_SERDEVICE "/dev/ttyUSB0"
+/* #define DEFAULT_SERDEVICE "/dev/ttyUSB0" */
+#define DEFAULT_SERDEVICE "/dev/cu.usbserial-SCP-JIM"
#define DEFAULT_NRTRACKS 164

#define log(_f, _a...) do { if (!quiet) printf(_f, ##_a); } while (0)
Great! Thanks for the info!