I recently bought a Connectland 5.25" external enclosure, allowing to connect a IDE peripheral (CD/DVD reader/writer, hard disk...) to a firewire or USB2 (works with USB1 too) computer.

For 75€, it was a bit expansive, but it can be quite useful if :
The design is a bit flashy but decent (light gray, blue and purple) ; the included cables are nice (silvery cables, à la Apple) but a bit short (there's a 6-6 firewire cable, and a A-B USB cable). The enclosure has 2 firewire ports and an USB port (similar to the one you probably have on your USB scanners, printers, and other devices) ; so you can plug a longer cable if you need. I used a 2 meters (6 feet) USB extender without any problem.

To get that thing to work with Linux thru the USB connector, you just need to insert the right HCI module (this is needed for any USB peripheral to work) :
Then, you need the usb_storage module ; and your disk or CD/DVD reader/writer will show up as an SCSI device. You can skip the next section.

To use it with the firewire link, you need to insert the ohci1394 module (needed for every ieee1394 device), and the sbp2 module. Then, you need an extra step there, because the kernel won't scan scsi/firewire hosts for peripherals ; you will need to hot-add them. You can do it manually with echo scsi add-single-device H C I L > /proc/scsi/scsi, where H is the host (as shown in the kernel as scsi0: SCSI emulation for IEEE-1394 SBP-2 Devices), C the SCSI channel (usually 0 ; maybe more if you have many firewire cards, I don't know), I the SCSI ID (0 for first peripheral ; I think that the next peripheral will be assigned ID 1, etc., but I could not try), L the SCSI LUN (always 0 I guess). So, to make it short, echo scsi add-single-device 0 0 0 0 > /proc/scsi/scsi should work if you don't have other SCSI interfaces, and only one peripheral. You can also use this  script (http://www.garloff.de/kurt/linux/rescan-scsi-bus.sh).

Once that your USB or firewire device is recognized as an SCSI device, you need sd_mod module (for hard disks) or sr_mod module (for cd/dvd drives). You might need sg for cd/dvd writers. Your device should then show up in kernel messages :

scsi2 : SCSI emulation for USB Mass Storage devices (this is usb_storage module)
  Vendor: PIONEER   Model: DVD-RW  DVR-107D  Rev: 1.10 (this is the "scan" of the USB/SCSI host)
  Type:   CD-ROM                             ANSI SCSI revision: 02
Attached scsi CD-ROM sr1 at scsi2, channel 0, id 0, lun 0 (this is sr_mod)
sr1: scsi3-mmc drive: 40x/40x writer cd/rw xa/form2 cdda tray

You can then mount your device and have fun.

NOTE FOR FIREWIRE USERS : if you get some freezes and very slow overall speed, and kernel mesages like the following one :

kernel: ieee1394: sbp2: aborting sbp2 command
kernel: Read (10) 00 08 b3 f2 5a 00 00 fe 00


... you might want to try to insert the sbp2 module with a special option, as explained here (http://lists.naos.co.nz/pipermail/wellylug/2003-December/004792.html). Just do modprobe sbp2 sbp2_serialize_io=1 and it should be fixed (it worked for me ; my DVD writer can read 8 MB/s without problems, else it's closer to 8 KB/s).

THINGS TO DO : try to daisy-chain 2 computers with firewire, and have them share a peripheral. Try to connect the enclosure thru firewire and USB2 simultaneously (don't try this at home, kids).

Some useful pages :
http://www.rimboy.com/firewire/



Now, if you have a DVD writer, here are some recipes that I used :
Then, I wanted to create a Video DVD from a DivX source. That's quite tricky. You need mjpegtools dvdauthor mencoder (or, rather, it's what I used). Being familiar with those tools will help.
  1. You need to encode the audio track into MPEG-2 layer-II, using mp2enc for instance. You should aim 224kbps bitrate, 2 channels, 48khz stream. It might be possible directly with mencoder (or your favorite transcoding/encoding software) ; you can also do mplayer -vo null -ao pcm foobar.avi and get a very large audiodump.wav file, then run mp2enc -b 224 -r 48 -s -o audiotrack.mp2 for instance. I positively think that there are better ways to do that, and it should be quite easy to figure out.
  2. You need to encode the video track. Here comes the hard part. In your MPEG-2 encoder, you must select "DVD profile" ; and even more, it seems that you have to insert special "navigation packets" at some point ; I used mpeg2enc, with -f 8 option. Quoting the manpage :  This version adds special dummy navigation packets into the output stream that the dvdauthor tool fills in to make a proper .VOB for authoring. As mpeg2enc only accepts YUV4MPEG input, you can use for instance mplayer -ao null -vo yuv4mpeg foobar.avi (warning, this will produce a very large stream.yuv file, up to 1 GB per minute) and then mpeg2enc -F 1 -f 8 -s -n p -b 4000 -o video.mpv (-F 1 specifies the framerate ; check mplayer output to see which framerate to use, and use -F 0 to see available framerates in the MPEG-2 encoder ; specifies special dvdauthor profile ; -n p is for PAL, and -b 4000 means 4000 kbps bitrate).
  3. Multiplex the audio and video track together : mplex -f 8 audio.mp2 video.mpv -o muxed.mpg.
  4. Now, mkdir mydvd, and do dvdauthor -o mydvd muxed.mpg ; if you split your MPEG file in parts, you can do dvdauthor -o mydvd a.mpg b.mpg foobar.mpg and they will end up as separate chapters on the DVD.
  5. Do dvdauthor --toc.
  6. Almost there ! mkisofs -dvd-video -udf -o mydvd.iso mydvd will make a good ISO image out of your directory (which should contain AUDIO_TS and VIDEO_TS like on "regular" Video DVDs).
  7. Finally, growisofs -Z /dev/scd0=mydvd.iso and voilà !
This got me a DVD good enough for mplayer, but VLC had some problems with it (it read 2 seconds, then paused ; I could seek a bit, but when seeking worked, it just played a couple of seconds then paused again). I don't know if it's my fault or VLC's (I had a lot of negative experiences with it, and even though it's streaming capabilites are awesome, it's overall stability and features on my specific hardware setup are very low compared to mplayer's or xine's. Your Mileage May Vary). I could not try with a set-top DVD player as I don't have one.

This site explains (in french) how to author a Video DVD with menus. It's worth a look.
http://www.funix.org/fr/linux/creedvd.htm



No warranty whatsoever, use at your own risk, feel free to send comments and corrections to skaya at enix dot org.