CDTOOL 2.1 Beta 5-1, 7/16/1998, Wade Hampton (whampton@staffnet.com) CDTOOL is a package for Linux that allows the user to control audio functions of an attached cd-rom drive from the command line. With minimal modifications, it should work with any operating system that uses compatible cd-rom ioctl's (ie, SunOS). The additional cdctrl allows a daemon to control the CD-ROM (e.g., via ioctl). CDTOOL consists of several programs. Actually, it is one program that can be called with multiple different names (cdown is a separate binary and cdadd is a shell script): cdplay -- play the CDROM or resume from pause. cdstart -- alternate name for cdplay (for those with cdp/cdplay). cdpause -- pause play. cdstop -- stop play. cdeject -- eject the CDROM, if supported. cdir -- list tracks on the CDROM. cdinfo -- display information on the CDROM. cdreset -- reset the CDROM device (2.1 experimental). cdshuffle -- play the tracks of the CDROM in random order. cdctrl -- interactive control of CDROM cdown -- query CDDB database for CD info cdadd -- add to local CD database With 2.1, a second binary, cdctrl, is also included. This is designed to be used to establish a connection with a CDROM and interactivly control it via standard input. This binary returns status in human- and machine-readable format, hence may be used to remotely control a CDROM, e.g., as a daemon. Note, cdctrl may also be automated via expect, TCL, perl or other scripting language. The cdir command supports a database of artist, title, and track names in a simple format compatible with Workman, a nice OPEN LOOK based program for controlling audio discs in a CDROM drive. It first looks in the user's ~/.cdtooldb file. Then, if the CDTOOLDBPATH environment variable is set to a colon-delimited list of files, cdir will check them in order until it finds the cd. This allows users to share a database, for example. There is a shell script, "cdadd", which automates adding entries to the file a bit, but Workman is better for this. The program cdown may also be used to read a CDROM's track info and query the CDDB database on the Internet (www.cddb.com). CDTOOL doesn't do anything fancy. There is no scan, fast forward, repeat, etc. These functions are better performed by a full-screen or graphical program, and CDTOOL is designed to be a simple, elegant command line utility. For more specifics on how to use the program, read the man page. Note, CDTOOL does include previous and next track access. Installation is simple. If needed, specify your cd-rom device file in config.h (it defaults to /dev/cdrom). By default, the binaries go into /usr/local/bin and the manual pages go into /usr/local/man. If you want to change these, edit the Makefile. Then, just type "make install" as root. When play begins on a track, the wrong track may be reported; this happens when the offset returned after the seek is a fraction of a second less than the start time for the track, with the result that the track is one less than it should be. Any subsequent requests for i/cdinfo report the correct track. CHANGES SINCE 2.0 RELEASE ---------------------------------------------- (1) SCSI build option added. This uses the CDROMPLAYMSF ioctl instead of the sometimes, not-supported CDROMPLAYTRKIND ioctl call (change to commands.c:do_play()). (2) Makefile includes "scsi", "debug", and "debugscsi" options. (3) Added new program, cdreset. This resets the CDROM drive. (4) Additional documentation. (5) Additional range checks, more robust. (6) Modules hardware.c, info.c, and commands.c now designed for multiple calls. (7) New program, cdctrl added. May be used as a CDROM daemon. (8) New features added (see man page). (9) Manual page updated and manual page for cdctrl written. CHANGES SINCE 2.1.1 RELEASE ---------------------------------------------- (1) Fixed cdctrl eject command causing a segmentation violation. (2) Fixed makefile debug option to not strip symbols. (3) Added command.h. (4) Fixed "read_hw" to always return a buffer, more robust. CHANGES SINCE 2.1.2 RELEASE ---------------------------------------------- (1) Fixed cdctrl to do a fflush after each command. May now be started via inetd for remote CD-ROM control. (2) Fixed makefile so "all" is the default make rule. CHANGES SINCE 2.1.4 RELEASE ---------------------------------------------- (1) Thomas Insel's address is tinsel@tinsel.org. An alternate mirror is at http://www.tinsel.org/files. (2) Some SCSI CD-ROMs do not properly start playing with cdplay. The disc detection code has been cleaned up (but still needs some work). (3) "cdplay" changed to "cdstart" to remove conflict with the cdplay from the cdp package. To restore the previous cdplay, comment out the LINKS line in Makefile and uncomment out the other one.... (4) Made option to make an RPM (make rpm). (5) Added some code documentation. Removed some warnings when building with "make debug". (6) Added "-p command" to cdtool for debugging (e.g., "cdtool -p info" is the same as "cdinfo"). (7) Shuffle mode added (written by Dan Risacher). (8) Bug running cdir without a database fixed. (9) Bug causing database lookup to fail fixed (10) Added -8 and -9, since my CD-R shows up as /dev/scd8. (11) Makefile changes to be more friendly to SCSI users and to properly make cdadd (missing from make all, make scsi, make scsidebug). (12) Added ability to shuffle play 1..100 tracks 1..N times with the -T and -R options. To play a single track at random, use: cdshuffle -R 1 -T 1 (13) cdctrl shuffle option only plays 1 track, at random (like -R 1 -T 1). (14) cdown added (written by Byron Ellacott with mods by W. Hampton). This queries the CDDB database on the Internet and results in output sutiable for inclusion in the user's CDROM database (for cdir, cdinfo, etc.). (15) Many fixes to hardware.c to properly recognize the state of the CDROM, including code from XPlaycd (code which was originally from WorkMan or WorkBone). (16) cdshuffle writes a PID file in /tmp/cdshuffle_N (N=CDROM #). Sending a SIGHUP will cause cdshuffle to skip to the next song. Sending a SIGINT will cause cdshuffle to stop playing, remove its PID file, and exit. (17) cdstop looks for a cdshuffle PID file for this CDROM and if present sends the cdshuffle a SIGINT to tell it to exit and cleanup. (18) Several functions were changed to have cddevice an argument, and to not use the global cd_device per recommendation of Lin. (19) cdctrl sometimes would cause segmentation violations due to cd_device not being global. Hacked, but cd_device should be made local and passed where needed (or better yet, pass a pointer to a CD control struture with {device name, device #, file des, debug fd, verbose flag, CRLF flag, etc.}). Thanks Lin for reporting this.... Most changes 2.0 -> 2.1 were done by Wade Hampton. 2.1.4-2.1.5 changes #7-11 by Daniel Risacher (magnus@mit.edu). Change 14 was by Byron Ellacott. Addition of a PID file and additonal cleanup by Lin Zhe Min. CHANGES SINCE BETA RELEASE --------------------------------------------- (1) CDTOOLDBPATH environment variable supported. (2) Bug in resuming from pause fixed. (3) Templates printed with -t option now are "filled out" if the current disc is listed in a database. (4) Make file creates links for manual pages during installation. (5) Code completely reorganized, getopt() used, etc. (6) Support for SunOS? If you have gcc, this should compile and run fine under SunOS 4.1.*, but I don't have the facilities to test it. If you get it working, please let me know. (7) CDTOOLDEV environment variable overrides default path to device. Changes (1) - (4) by suggestion of Fred Baumgarten. Thanks! CHANGES SINCE 1.0 RELEASE ---------------------------------------------- (1) Bug in Play From-Track-To-Track fixed. (2) cdinfo command added. (3) Code again reorganized. (4) Skip track option in cdplay added. (5) Multiple cdrom device support added. All changes 1.0 -> 2.0 were done by Sven Oliver Moll STILL TO BE DONE ------------------------------------------------------- (1) Nice interface for editing the database files. (2) Fast forward, Rewind. (3) Code cleanup and documentation. COPYRIGHT AND LICENSE AND STUFF ---------------------------------------- CDTOOL 1.0 is Copyright 1994 Thomas Insel. It may be distributed freely under the terms of the GPL. For more information, read the files "COPYING" and "main.c". CDTOOL 2.0 is Copyright 1995,96 Sven Oliver Moll. Since it was GPL, it still is GPL. CDTOOL 2.1 is Copyright 1997,98 Wade Hampton, Dan Risacher, Lin Zhe Min, Byron Ellacott, and the original authors. Since it was GPL, it is still GPL. I have used some code from XPlaycd (mainly in hardware.c) which is by Olav Woelfelschneider. Per the CREDITS file with XPlaycd, this code was originally from WdorkBone and/or WorkMan. Thanks for OpenSource! EMAIL: Byron Ellacott Wade Hampton Thomas Insel Lin Zhe Min Sven Oliver Moll Daniel R. Risacher Olav Woelfelschneider Please let me know if you make any useful modifications, successfully run CDTOOL under an operating system besides Linux, are interested in different licensing terms, find CDTOOL useful, or whatever. Please address all correspondance regarding CDTOOL to tinsel@tinsel.org, whampton@staffnet.com, or to Thomas Insel, 210 Parkview Drive, Bloomington, IL 61701-2038. The newest version of CDTOOL can be obtained via anonymous ftp from sunsite.unc.edu Also it may be obtained from jaka.cerl.uiuc.edu in the directory /pub/tinsel. [Need to check the FTP listing above -- did not work the last time I tried it! -- Wade] Alternate FTP site: TBD, ftp://sunsite.unc.edu/pub/Linux/ ------------------------------------------------------------------------