Code‎ > ‎

scanjet

#####################
ScanJet Scanner music
#####################

Background
##########

Old scanners that use a stepper motor emit frequencies depending on the speed of the motor. By using the scanner's Scanner Command Language, it is possible to use play music on the scanner. A PDF documenting the Play Tune command is located at HP website: `"Sing to Me" <http://www.hpl.hp.com/hpjournal/97feb/feb97a8.htm>`_ . [a]_

To hear a built-in sample, simply set the SCSI ID to 0, unplug the power cord, hold down the button, and replug the power cord.


Setting SCSI ID
###############

SCSI devices are assigned a ID from 0 to 7.

Some scanners include a dial that you can easily adjust. For scanners without a dial, there are types of methods of setting the ID.

For scanners with a button and a power light, such as a ScanJet 5100c, hold down the button until you see the number of blinks which correspond to the ID number. So if you want to set an ID of 0, hold the button until the light turns off and immediately release it. To set it to 4, hold the button, wait to it turns off, count 4 blinks and release.

Other scanners include a SCSI light inside the scanner. Hold down the button and count the number of blinks which corresponds to one more than the ID. To set it to 0, hold down the button until you see 1 blink. To set it to 4, hold down the button for 5 blinks.




ScanJetPlay
###########

Using the programs available at www.ganjatron.net, you can easily create and send music to be played on the scanner.

If you have a scanner the connects using a parallel printer port, please see the section on PPSCSI.

Compiling ScanJetPlay
=====================

Each step includes sample commands for a Debian, Ubuntu, or Debian-derived distro system.

1. Create a directory for all the files and change to it.
    ~$ mkdir scanjetplay; cd scanjetplay
2. Ensure that `<apt://build-essential>`_ is installed.
    ~/scanjetplay$ sudo apt-get install build-essential
    
3. Obtain the sources at www.ganjatron.net (or here).
    ~/scanjetplay$ wget http://www.ganjatron.net/misc/scanjet/sjetplay.tar.gz
    
4. Unpack it.
    ~/scanjetplay$ tar -xzf sjetplay.tar.gz
    
5. Obtain the sources at SANE Project.
    ~/scanjetplay$ wget http://alioth.debian.org/frs/download.php/2318/sane-backends-1.0.19.tar.gz
    
6. Unpack it.
    ~/scanjetplay$ tar -xzf sane-backends-1.0.19.tar.gz
    
7. Create a symlink to the sane sources.
    ~/scanjetplay$ cd sjetplay; ln -s ../sane-backends-1.0.18 sane; cd ..
    
8. Build the SANE sources 

::

~/scanjetplay$ cd sane-backends-1.0.19/
~/scanjetplay/sane-backends-1.0.19$ ./configure
~/scanjetplay/sane-backends-1.0.19$ make; cd ..

9. Edit the sjetplay/Makefile to like this:

::

CFLAGS = -g- B"./sane/"
LDFLAGS = -L "./sane/sanei/"
all: sjetplay sjetnasm

sjetplay: sjetplay.c
$(CC) $(CFLAGS) sjetplay.c -o sjetplay $(LDFLAGS) -lsanei

sjetnasm: sjetnasm.c
$(CC) $(CFLAGS) sjetnasm.c -o sjetnasm $(LDFLAGS)

11. Build sjetplay and sjetnasm.
     ~/scanjetplay$ cd sjetplay; make

12. sjetplay and sjetnasm should be built.

Running ScanJetPlay
===================

.. warning::
If you find that when you run it and you hear sounds like "clunk" or "c-c-c-click" or you notice the scanner head move towards all the way to the end, turn it off! Be sure to have fully read and understood the readme file on www.ganjatron.net before trying out ScanJetPlay.

.. warning:: Do not run sjetplay with root permissions, you may risk or accidentally cause data corruption to your hard drive or other media. Instead, ensure you are part of the "scanner" group as the appropriate /dev/dg? is set with "scanner" group permissions. Do not try to set permissions on the devices unless you know what you are doing.

Finding scanner device
======================

To find the scanner on the system, use sane-find-scanner. As well, you can use ls /dev/sg* -l and look for the device with scanner permissions. For parallel port to USB, try ls /dev/lp* -l

Creating a music file
=====================

``~/scanjetplay/sjetplay$ ./sjetnasm < music.sjn > music.sjn.bin``

Playing a music file
====================

``~/scanjetplay/sjetplay$ ./sjetplay /dev/sg5 music.sjn.bin``

SCSI over parallel port
#######################

Note: I still havn't gotten it to play music successfully yet .

If your scanner is connected through a parallel port, you will need kernel modules ppscsi and epst for this function. 

Load the ppscsi and epst modules::
sudo modprobe -v epst

(Note: epst depends on ppscsi so ppscsi is loaded as well)

If the result is "fatal", make sure that the scanner is connected. Otherwise, try rebooting.

To ensure the modules are loaded up at start, add a line with epst to the file /etc/modules

.. [a] http://www.ganjatron.net/misc/scanjet/


Comments