sbpcd 36 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061
  1. This README belongs to release 4.2 or newer of the SoundBlaster Pro
  2. (Matsushita, Kotobuki, Panasonic, CreativeLabs, Longshine and Teac)
  3. CD-ROM driver for Linux.
  4. sbpcd really, really is NOT for ANY IDE/ATAPI drive!
  5. Not even if you have an "original" SoundBlaster card with an IDE interface!
  6. So, you'd better have a look into README.ide if your port address is 0x1F0,
  7. 0x170, 0x1E8, 0x168 or similar.
  8. I get tons of mails from IDE/ATAPI drive users - I really can't continue
  9. any more to answer them all. So, if your drive/interface information sheets
  10. mention "IDE" (primary, secondary, tertiary, quaternary) and the DOS driver
  11. invoking line within your CONFIG.SYS is using an address below 0x230:
  12. DON'T ROB MY LAST NERVE - jumper your interface to address 0x170 and IRQ 15
  13. (that is the "secondary IDE" configuration), set your drive to "master" and
  14. use ide-cd as your driver. If you do not have a second IDE hard disk, use the
  15. LILO commands
  16. hdb=noprobe hdc=cdrom
  17. and get lucky.
  18. To make it fully clear to you: if you mail me about IDE/ATAPI drive problems,
  19. my answer is above, and I simply will discard your mail, hoping to stop the
  20. flood and to find time to lead my 12-year old son towards happy computing.
  21. The driver is able to drive the whole family of "traditional" AT-style (that
  22. is NOT the new "Enhanced IDE" or "ATAPI" drive standard) Matsushita,
  23. Kotobuki, Panasonic drives, sometimes labelled as "CreativeLabs". The
  24. well-known drives are CR-521, CR-522, CR-523, CR-562, CR-563.
  25. CR-574 is an IDE/ATAPI drive.
  26. The Longshine LCS-7260 is a double-speed drive which uses the "old"
  27. Matsushita command set. It is supported - with help by Serge Robyns.
  28. Vertos ("Elitegroup Computer Systems", ECS) has a similar drive - support
  29. has started; get in contact if you have such a "Vertos 100" or "ECS-AT"
  30. drive.
  31. There exists an "IBM External ISA CD-ROM Drive" which in fact is a CR-563
  32. with a special controller board. This drive is supported (the interface is
  33. of the "LaserMate" type), and it is possibly the best buy today (cheaper than
  34. an internal drive, and you can use it as an internal, too - e.g. plug it into
  35. a soundcard).
  36. CreativeLabs has a new drive "CD200" and a similar drive "CD200F". The latter
  37. is made by Funai and sometimes named "E2550UA", newer models may be named
  38. "MK4015". The CD200F drives should fully work.
  39. CD200 drives without "F" are still giving problems: drive detection and
  40. playing audio should work, data access will result in errors. I need qualified
  41. feedback about the bugs within the data functions or a drive (I never saw a
  42. CD200).
  43. The quad-speed Teac CD-55A drive is supported, but still does not reach "full
  44. speed". The data rate already reaches 500 kB/sec if you set SBP_BUFFER_FRAMES
  45. to 64 (it is not recommended to do that for normal "file access" usage, but it
  46. can speed up things a lot if you use something like "dd" to read from the
  47. drive; I use it for verifying self-written CDs this way).
  48. The drive itself is able to deliver 600 kB/sec, so this needs
  49. work; with the normal setup, the performance currently is not even as good as
  50. double-speed.
  51. This driver is NOT for Mitsumi or Sony or Aztech or Philips or XXX drives,
  52. and again: this driver is in no way usable for any IDE/ATAPI drive. If you
  53. think your drive should work and it doesn't: send me the DOS driver for your
  54. beast (gzipped + uuencoded) and your CONFIG.SYS if you want to ask me for help,
  55. and include an original log message excerpt, and try to give all information
  56. a complete idiot needs to understand your hassle already with your first
  57. mail. And if you want to say "as I have mailed you before", be sure that I
  58. don't remember your "case" by such remarks; at the moment, I have some
  59. hundreds of open correspondences about Linux CDROM questions (hope to reduce if
  60. the IDE/ATAPI user questions disappear).
  61. This driver will work with the soundcard interfaces (SB Pro, SB 16, Galaxy,
  62. SoundFX, Mozart, MAD16 ...) and with the "no-sound" cards (Panasonic CI-101P,
  63. LaserMate, WDH-7001C, Longshine LCS-6853, Teac ...).
  64. It works with the "configurable" interface "Sequoia S-1000", too, which is
  65. used on the Spea Media FX and Ensonic Soundscape sound cards. You have to
  66. specify the type "SBPRO 2" and the true CDROM port address with it, not the
  67. "configuration port" address.
  68. If you have a sound card which needs a "configuration driver" instead of
  69. jumpers for interface types and addresses (like Mozart cards) - those
  70. drivers get invoked before the DOS CDROM driver in your CONFIG.SYS, typical
  71. names are "cdsetup.sys" and "mztinit.sys" - let the sound driver do the
  72. CDROM port configuration (the leading comments in linux/drivers/sound/mad16.c
  73. are just for you!). Hannu Savolainen's mad16.c code is able to set up my
  74. Mozart card - I simply had to add
  75. #define MAD16_CONF 0x06
  76. #define MAD16_CDSEL 0x03
  77. to configure the CDROM interface for type "Panasonic" (LaserMate) and address
  78. 0x340.
  79. The interface type has to get configured in linux/drivers/cdrom/sbpcd.h,
  80. because the register layout is different between the "SoundBlaster" and the
  81. "LaserMate" type.
  82. I got a report that the Teac interface card "I/F E117098" is of type
  83. "SoundBlaster" (i.e. you have to set SBPRO to 1) even with the addresses
  84. 0x300 and above. This is unusual, and it can't get covered by the auto
  85. probing scheme.
  86. The Teac 16-bit interface cards (like P/N E950228-00A, default address 0x2C0)
  87. need the SBPRO 3 setup.
  88. If auto-probing found the drive, the address is correct. The reported type
  89. may be wrong. A "mount" will give success only if the interface type is set
  90. right. Playing audio should work with a wrong set interface type, too.
  91. With some Teac and some CD200 drives I have seen interface cards which seem
  92. to lack the "drive select" lines; always drive 0 gets addressed. To avoid
  93. "mirror drives" (four drives detected where you only have one) with such
  94. interface cards, set MAX_DRIVES to 1 and jumper your drive to ID 0 (if
  95. possible).
  96. Up to 4 drives per interface card, and up to 4 interface cards are supported.
  97. All supported drive families can be mixed, but the CR-521 drives are
  98. hard-wired to drive ID 0. The drives have to use different drive IDs, and each
  99. drive has to get a unique minor number (0...3), corresponding indirectly to
  100. its drive ID.
  101. The drive IDs may be selected freely from 0 to 3 - they do not have to be in
  102. consecutive order.
  103. As Don Carroll, don@ds9.us.dell.com or FIDO 1:382/14, told me, it is possible
  104. to change old drives to any ID, too. He writes in this sense:
  105. "In order to be able to use more than one single speed drive
  106. (they do not have the ID jumpers) you must add a DIP switch
  107. and two resistors. The pads are already on the board next to
  108. the power connector. You will see the silkscreen for the
  109. switch if you remove the top cover.
  110. 1 2 3 4
  111. ID 0 = x F F x O = "on"
  112. ID 1 = x O F x F = "off"
  113. ID 2 = x F O x x = "don't care"
  114. ID 3 = x O O x
  115. Next to the switch are the positions for R76 (7k) and R78
  116. (12k). I had to play around with the resistor values - ID 3
  117. did not work with other values. If the values are not good,
  118. ID 3 behaves like ID 0."
  119. To use more than 4 drives, you simply need a second controller card at a
  120. different address and a second cable.
  121. The driver supports reading of data from the CD and playing of audio tracks.
  122. The audio part should run with WorkMan, xcdplayer, with the "non-X11" products
  123. CDplayer and WorkBone - tell me if it is not compatible with other software.
  124. The only accepted measure for correctness with the audio functions is the
  125. "cdtester" utility (appended) - most audio player programmers seem to be
  126. better musicians than programmers. ;-)
  127. With the CR-56x and the CD200 drives, the reading of audio frames is possible.
  128. This is implemented by an IOCTL function which reads READ_AUDIO frames of
  129. 2352 bytes at once (configurable with the "READ_AUDIO" define, default is 0).
  130. Reading the same frame a second time gives different data; the frame data
  131. start at a different position, but all read bytes are valid, and we always
  132. read 98 consecutive chunks (of 24 Bytes) as a frame. Reading more than 1 frame
  133. at once possibly misses some chunks at each frame boundary. This lack has to
  134. get corrected by external, "higher level" software which reads the same frame
  135. again and tries to find and eliminate overlapping chunks (24-byte-pieces).
  136. The transfer rate with reading audio (1-frame-pieces) currently is very slow.
  137. This can be better reading bigger chunks, but the "missing" chunks possibly
  138. occur at the beginning of each single frame.
  139. The software interface possibly may change a bit the day the SCSI driver
  140. supports it too.
  141. With all but the CR-52x drives, MultiSession is supported.
  142. Photo CDs work (the "old" drives like CR-521 can access only the first
  143. session of a photoCD).
  144. At ftp.gwdg.de:/pub/linux/hpcdtoppm/ you will find Hadmut Danisch's package to
  145. convert photo CD image files and Gerd Knorr's viewing utility.
  146. The transfer rate will reach 150 kB/sec with CR-52x drives, 300 kB/sec with
  147. CR-56x drives, and currently not more than 500 kB/sec (usually less than
  148. 250 kB/sec) with the Teac quad speed drives.
  149. XA (PhotoCD) disks with "old" drives give only 50 kB/sec.
  150. This release consists of
  151. - this README file
  152. - the driver file linux/drivers/cdrom/sbpcd.c
  153. - the stub files linux/drivers/cdrom/sbpcd[234].c
  154. - the header file linux/drivers/cdrom/sbpcd.h.
  155. To install:
  156. -----------
  157. 1. Setup your hardware parameters. Though the driver does "auto-probing" at a
  158. lot of (not all possible!) addresses, this step is recommended for
  159. everyday use. You should let sbpcd auto-probe once and use the reported
  160. address if a drive got found. The reported type may be incorrect; it is
  161. correct if you can mount a data CD. There is no choice for you with the
  162. type; only one is right, the others are deadly wrong.
  163. a. Go into /usr/src/linux/drivers/cdrom/sbpcd.h and configure it for your
  164. hardware (near the beginning):
  165. a1. Set it up for the appropriate type of interface board.
  166. "Original" CreativeLabs sound cards need "SBPRO 1".
  167. Most "compatible" sound cards (almost all "non-CreativeLabs" cards)
  168. need "SBPRO 0".
  169. The "no-sound" board from OmniCd needs the "SBPRO 1" setup.
  170. The Teac 8-bit "no-sound" boards need the "SBPRO 1" setup.
  171. The Teac 16-bit "no-sound" boards need the "SBPRO 3" setup.
  172. All other "no-sound" boards need the "SBPRO 0" setup.
  173. The Spea Media FX and Ensoniq SoundScape cards need "SBPRO 2".
  174. sbpcd.c holds some examples in its auto-probe list.
  175. If you configure "SBPRO" wrong, the playing of audio CDs will work,
  176. but you will not be able to mount a data CD.
  177. a2. Tell the address of your CDROM_PORT (not of the sound port).
  178. a3. If 4 drives get found, but you have only one, set MAX_DRIVES to 1.
  179. a4. Set DISTRIBUTION to 0.
  180. b. Additionally for 2.a1 and 2.a2, the setup may be done during
  181. boot time (via the "kernel command line" or "LILO option"):
  182. sbpcd=0x320,LaserMate
  183. or
  184. sbpcd=0x230,SoundBlaster
  185. or
  186. sbpcd=0x338,SoundScape
  187. or
  188. sbpcd=0x2C0,Teac16bit
  189. This is especially useful if you install a fresh distribution.
  190. If the second parameter is a number, it gets taken as the type
  191. setting; 0 is "LaserMate", 1 is "SoundBlaster", 2 is "SoundScape",
  192. 3 is "Teac16bit".
  193. So, for example
  194. sbpcd=0x230,1
  195. is equivalent to
  196. sbpcd=0x230,SoundBlaster
  197. 2. "cd /usr/src/linux" and do a "make config" and select "y" for Matsushita
  198. CD-ROM support and for ISO9660 FileSystem support. If you do not have a
  199. second, third, or fourth controller installed, do not say "y" to the
  200. secondary Matsushita CD-ROM questions.
  201. 3. Then make the kernel image ("make zlilo" or similar).
  202. 4. Make the device file(s). This step usually already has been done by the
  203. MAKEDEV script.
  204. The driver uses MAJOR 25, so, if necessary, do
  205. mknod /dev/sbpcd b 25 0 (if you have only one drive)
  206. and/or
  207. mknod /dev/sbpcd0 b 25 0
  208. mknod /dev/sbpcd1 b 25 1
  209. mknod /dev/sbpcd2 b 25 2
  210. mknod /dev/sbpcd3 b 25 3
  211. to make the node(s).
  212. The "first found" drive gets MINOR 0 (regardless of its jumpered ID), the
  213. "next found" (at the same cable) gets MINOR 1, ...
  214. For a second interface board, you have to make nodes like
  215. mknod /dev/sbpcd4 b 26 0
  216. mknod /dev/sbpcd5 b 26 1
  217. and so on. Use the MAJORs 26, 27, 28.
  218. If you further make a link like
  219. ln -s sbpcd /dev/cdrom
  220. you can use the name /dev/cdrom, too.
  221. 5. Reboot with the new kernel.
  222. You should now be able to do
  223. mkdir /CD
  224. and
  225. mount -rt iso9660 /dev/sbpcd /CD
  226. or
  227. mount -rt iso9660 -o block=2048 /dev/sbpcd /CD
  228. and see the contents of your CD in the /CD directory.
  229. To use audio CDs, a mounting is not recommended (and it would fail if the
  230. first track is not a data track).
  231. Using sbpcd as a "loadable module":
  232. -----------------------------------
  233. If you do NOT select "Matsushita/Panasonic CDROM driver support" during the
  234. "make config" of your kernel, you can build the "loadable module" sbpcd.o.
  235. If sbpcd gets used as a module, the support of more than one interface
  236. card (i.e. drives 4...15) is disabled.
  237. You can specify interface address and type with the "insmod" command like:
  238. # insmod /usr/src/linux/modules/sbpcd.o sbpcd=0x340,0
  239. or
  240. # insmod /usr/src/linux/modules/sbpcd.o sbpcd=0x230,1
  241. or
  242. # insmod /usr/src/linux/modules/sbpcd.o sbpcd=0x338,2
  243. where the last number represents the SBPRO setting (no strings allowed here).
  244. Things of interest:
  245. -------------------
  246. The driver is configured to try the LaserMate type of interface at I/O port
  247. 0x0340 first. If this is not appropriate, sbpcd.h should get changed
  248. (you will find the right place - just at the beginning).
  249. No DMA and no IRQ is used.
  250. To reduce or increase the amount of kernel messages, edit sbpcd.c and play
  251. with the "DBG_xxx" switches (initialization of the variable "sbpcd_debug").
  252. Don't forget to reflect on what you do; enabling all DBG_xxx switches at once
  253. may crash your system, and each message line is accompanied by a delay.
  254. The driver uses the "variable BLOCK_SIZE" feature. To use it, you have to
  255. specify "block=2048" as a mount option. Doing this will disable the direct
  256. execution of a binary from the CD; you have to copy it to a device with the
  257. standard BLOCK_SIZE (1024) first. So, do not use this if your system is
  258. directly "running from the CDROM" (like some of Yggdrasil's installation
  259. variants). There are CDs on the market (like the German "unifix" Linux
  260. distribution) which MUST get handled with a block_size of 1024. Generally,
  261. one can say all the CDs which hold files of the name YMTRANS.TBL are defective;
  262. do not use block=2048 with those.
  263. Within sbpcd.h, you will find some "#define"s (e.g. EJECT and JUKEBOX). With
  264. these, you can configure the driver for some special things.
  265. You can use the appended program "cdtester" to set the auto-eject feature
  266. during runtime. Jeff Tranter's "eject" utility can do this, too (and more)
  267. for you.
  268. There is an ioctl CDROMMULTISESSION to obtain with a user program if
  269. the CD is an XA disk and - if it is - where the last session starts. The
  270. "cdtester" program illustrates how to call it.
  271. Auto-probing at boot time:
  272. --------------------------
  273. The driver does auto-probing at many well-known interface card addresses,
  274. but not all:
  275. Some probings can cause a hang if an NE2000 ethernet card gets touched, because
  276. SBPCD's auto-probing happens before the initialization of the net drivers.
  277. Those "hazardous" addresses are excluded from auto-probing; the "kernel
  278. command line" feature has to be used during installation if you have your
  279. drive at those addresses. The "module" version is allowed to probe at those
  280. addresses, too.
  281. The auto-probing looks first at the configured address resp. the address
  282. submitted by the kernel command line. With this, it is possible to use this
  283. driver within installation boot floppies, and for any non-standard address,
  284. too.
  285. Auto-probing will make an assumption about the interface type ("SBPRO" or not),
  286. based upon the address. That assumption may be wrong (initialization will be
  287. o.k., but you will get I/O errors during mount). In that case, use the "kernel
  288. command line" feature and specify address & type at boot time to find out the
  289. right setup.
  290. For everyday use, address and type should get configured within sbpcd.h. That
  291. will stop the auto-probing due to success with the first try.
  292. The kernel command "sbpcd=0" suppresses each auto-probing and causes
  293. the driver not to find any drive; it is meant for people who love sbpcd
  294. so much that they do not want to miss it, even if they miss the drives. ;-)
  295. If you configure "#define CDROM_PORT 0" in sbpcd.h, the auto-probing is
  296. initially disabled and needs an explicit kernel command to get activated.
  297. Once activated, it does not stop before success or end-of-list. This may be
  298. useful within "universal" CDROM installation boot floppies (but using the
  299. loadable module would be better because it allows an "extended" auto-probing
  300. without fearing NE2000 cards).
  301. To shorten the auto-probing list to a single entry, set DISTRIBUTION 0 within
  302. sbpcd.h.
  303. Setting up address and interface type:
  304. --------------------------------------
  305. If your I/O port address is not 0x340, you have to look for the #defines near
  306. the beginning of sbpcd.h and configure them: set SBPRO to 0 or 1 or 2, and
  307. change CDROM_PORT to the address of your CDROM I/O port.
  308. Almost all of the "SoundBlaster compatible" cards behave like the no-sound
  309. interfaces, i.e. need SBPRO 0!
  310. With "original" SB Pro cards, an initial setting of CD_volume through the
  311. sound card's MIXER register gets done.
  312. If you are using a "compatible" sound card of types "LaserMate" or "SPEA",
  313. you can set SOUND_BASE (in sbpcd.h) to get it done with your card, too...
  314. Using audio CDs:
  315. ----------------
  316. Workman, WorkBone, xcdplayer, cdplayer and the nice little tool "cdplay" (see
  317. README.aztcd from the Aztech driver package) should work.
  318. The program CDplayer likes to talk to "/dev/mcd" only, xcdplayer wants
  319. "/dev/rsr0", workman loves "/dev/sr0" or "/dev/cdrom" - so, make the
  320. appropriate links to use them without the need to supply parameters.
  321. Copying audio tracks:
  322. ---------------------
  323. The following program will copy track 1 (or a piece of it) from an audio CD
  324. into the file "track01":
  325. /*=================== begin program ========================================*/
  326. /*
  327. * read an audio track from a CD
  328. *
  329. * (c) 1994 Eberhard Moenkeberg <emoenke@gwdg.de>
  330. * may be used & enhanced freely
  331. *
  332. * Due to non-existent sync bytes at the beginning of each audio frame (or due
  333. * to a firmware bug within all known drives?), it is currently a kind of
  334. * fortune if two consecutive frames fit together.
  335. * Usually, they overlap, or a little piece is missing. This happens in units
  336. * of 24-byte chunks. It has to get fixed by higher-level software (reading
  337. * until an overlap occurs, and then eliminate the overlapping chunks).
  338. * ftp.gwdg.de:/pub/linux/misc/cdda2wav-sbpcd.*.tar.gz holds an example of
  339. * such an algorithm.
  340. * This example program further is missing to obtain the SubChannel data
  341. * which belong to each frame.
  342. *
  343. * This is only an example of the low-level access routine. The read data are
  344. * pure 16-bit CDDA values; they have to get converted to make sound out of
  345. * them.
  346. * It is no fun to listen to it without prior overlap/underlap correction!
  347. */
  348. #include <stdio.h>
  349. #include <sys/ioctl.h>
  350. #include <sys/types.h>
  351. #include <linux/cdrom.h>
  352. static struct cdrom_tochdr hdr;
  353. static struct cdrom_tocentry entry[101];
  354. static struct cdrom_read_audio arg;
  355. static u_char buffer[CD_FRAMESIZE_RAW];
  356. static int datafile, drive;
  357. static int i, j, limit, track, err;
  358. static char filename[32];
  359. int main(int argc, char *argv[])
  360. {
  361. /*
  362. * open /dev/cdrom
  363. */
  364. drive=open("/dev/cdrom", 0);
  365. if (drive<0)
  366. {
  367. fprintf(stderr, "can't open drive.\n");
  368. exit (-1);
  369. }
  370. /*
  371. * get TocHeader
  372. */
  373. fprintf(stdout, "getting TocHeader...\n");
  374. err=ioctl(drive, CDROMREADTOCHDR, &hdr);
  375. if (err!=0)
  376. {
  377. fprintf(stderr, "can't get TocHeader (error %d).\n", err);
  378. exit (-1);
  379. }
  380. else
  381. fprintf(stdout, "TocHeader: %d %d\n", hdr.cdth_trk0, hdr.cdth_trk1);
  382. /*
  383. * get and display all TocEntries
  384. */
  385. fprintf(stdout, "getting TocEntries...\n");
  386. for (i=1;i<=hdr.cdth_trk1+1;i++)
  387. {
  388. if (i!=hdr.cdth_trk1+1) entry[i].cdte_track = i;
  389. else entry[i].cdte_track = CDROM_LEADOUT;
  390. entry[i].cdte_format = CDROM_LBA;
  391. err=ioctl(drive, CDROMREADTOCENTRY, &entry[i]);
  392. if (err!=0)
  393. {
  394. fprintf(stderr, "can't get TocEntry #%d (error %d).\n", i, err);
  395. exit (-1);
  396. }
  397. else
  398. {
  399. fprintf(stdout, "TocEntry #%d: %1X %1X %06X %02X\n",
  400. entry[i].cdte_track,
  401. entry[i].cdte_adr,
  402. entry[i].cdte_ctrl,
  403. entry[i].cdte_addr.lba,
  404. entry[i].cdte_datamode);
  405. }
  406. }
  407. fprintf(stdout, "got all TocEntries.\n");
  408. /*
  409. * ask for track number (not implemented here)
  410. */
  411. track=1;
  412. #if 0 /* just read a little piece (4 seconds) */
  413. entry[track+1].cdte_addr.lba=entry[track].cdte_addr.lba+300;
  414. #endif
  415. /*
  416. * read track into file
  417. */
  418. sprintf(filename, "track%02d\0", track);
  419. datafile=creat(filename, 0755);
  420. if (datafile<0)
  421. {
  422. fprintf(stderr, "can't open datafile %s.\n", filename);
  423. exit (-1);
  424. }
  425. arg.addr.lba=entry[track].cdte_addr.lba;
  426. arg.addr_format=CDROM_LBA; /* CDROM_MSF would be possible here, too. */
  427. arg.nframes=1;
  428. arg.buf=&buffer[0];
  429. limit=entry[track+1].cdte_addr.lba;
  430. for (;arg.addr.lba<limit;arg.addr.lba++)
  431. {
  432. err=ioctl(drive, CDROMREADAUDIO, &arg);
  433. if (err!=0)
  434. {
  435. fprintf(stderr, "can't read abs. frame #%d (error %d).\n",
  436. arg.addr.lba, err);
  437. }
  438. j=write(datafile, &buffer[0], CD_FRAMESIZE_RAW);
  439. if (j!=CD_FRAMESIZE_RAW)
  440. {
  441. fprintf(stderr,"I/O error (datafile) at rel. frame %d\n",
  442. arg.addr.lba-entry[track].cdte_addr.lba);
  443. }
  444. arg.addr.lba++;
  445. }
  446. return 0;
  447. }
  448. /*===================== end program ========================================*/
  449. At ftp.gwdg.de:/pub/linux/misc/cdda2wav-sbpcd.*.tar.gz is an adapted version of
  450. Heiko Eissfeldt's digital-audio to .WAV converter (the original is there, too).
  451. This is preliminary, as Heiko himself will care about it.
  452. Known problems:
  453. ---------------
  454. Currently, the detection of disk change or removal is actively disabled.
  455. Most attempts to read the UPC/EAN code result in a stream of zeroes. All my
  456. drives are mostly telling there is no UPC/EAN code on disk or there is, but it
  457. is an all-zero number. I guess now almost no CD holds such a number.
  458. Bug reports, comments, wishes, donations (technical information is a donation,
  459. too :-) etc. to emoenke@gwdg.de.
  460. SnailMail address, preferable for CD editors if they want to submit a free
  461. "cooperation" copy:
  462. Eberhard Moenkeberg
  463. Reinholdstr. 14
  464. D-37083 Goettingen
  465. Germany
  466. ---
  467. Appendix -- the "cdtester" utility:
  468. /*
  469. * cdtester.c -- test the audio functions of a CD driver
  470. *
  471. * (c) 1995 Eberhard Moenkeberg <emoenke@gwdg.de>
  472. * published under the GPL
  473. *
  474. * made under heavy use of the "Tiny Audio CD Player"
  475. * from Werner Zimmermann <zimmerma@rz.fht-esslingen.de>
  476. * (see linux/drivers/block/README.aztcd)
  477. */
  478. #undef AZT_PRIVATE_IOCTLS /* not supported by every CDROM driver */
  479. #define SBP_PRIVATE_IOCTLS /* not supported by every CDROM driver */
  480. #include <stdio.h>
  481. #include <stdio.h>
  482. #include <malloc.h>
  483. #include <sys/ioctl.h>
  484. #include <sys/types.h>
  485. #include <linux/cdrom.h>
  486. #ifdef AZT_PRIVATE_IOCTLS
  487. #include <linux/../../drivers/cdrom/aztcd.h>
  488. #endif /* AZT_PRIVATE_IOCTLS */
  489. #ifdef SBP_PRIVATE_IOCTLS
  490. #include <linux/../../drivers/cdrom/sbpcd.h>
  491. #include <linux/fs.h>
  492. #endif /* SBP_PRIVATE_IOCTLS */
  493. struct cdrom_tochdr hdr;
  494. struct cdrom_tochdr tocHdr;
  495. struct cdrom_tocentry TocEntry[101];
  496. struct cdrom_tocentry entry;
  497. struct cdrom_multisession ms_info;
  498. struct cdrom_read_audio read_audio;
  499. struct cdrom_ti ti;
  500. struct cdrom_subchnl subchnl;
  501. struct cdrom_msf msf;
  502. struct cdrom_volctrl volctrl;
  503. #ifdef AZT_PRIVATE_IOCTLS
  504. union
  505. {
  506. struct cdrom_msf msf;
  507. unsigned char buf[CD_FRAMESIZE_RAW];
  508. } azt;
  509. #endif /* AZT_PRIVATE_IOCTLS */
  510. int i, i1, i2, i3, j, k;
  511. unsigned char sequence=0;
  512. unsigned char command[80];
  513. unsigned char first=1, last=1;
  514. char *default_device="/dev/cdrom";
  515. char dev[20];
  516. char filename[20];
  517. int drive;
  518. int datafile;
  519. int rc;
  520. void help(void)
  521. {
  522. printf("Available Commands:\n");
  523. printf("STOP s EJECT e QUIT q\n");
  524. printf("PLAY TRACK t PAUSE p RESUME r\n");
  525. printf("NEXT TRACK n REPEAT LAST l HELP h\n");
  526. printf("SUBCHANNEL_Q c TRACK INFO i PLAY AT a\n");
  527. printf("READ d READ RAW w READ AUDIO A\n");
  528. printf("MS-INFO M TOC T START S\n");
  529. printf("SET EJECTSW X DEVICE D DEBUG Y\n");
  530. printf("AUDIO_BUFSIZ Z RESET R SET VOLUME v\n");
  531. printf("GET VOLUME V\n");
  532. }
  533. /*
  534. * convert MSF number (3 bytes only) to Logical_Block_Address
  535. */
  536. int msf2lba(u_char *msf)
  537. {
  538. int i;
  539. i=(msf[0] * CD_SECS + msf[1]) * CD_FRAMES + msf[2] - CD_BLOCK_OFFSET;
  540. if (i<0) return (0);
  541. return (i);
  542. }
  543. /*
  544. * convert logical_block_address to m-s-f_number (3 bytes only)
  545. */
  546. void lba2msf(int lba, unsigned char *msf)
  547. {
  548. lba += CD_BLOCK_OFFSET;
  549. msf[0] = lba / (CD_SECS*CD_FRAMES);
  550. lba %= CD_SECS*CD_FRAMES;
  551. msf[1] = lba / CD_FRAMES;
  552. msf[2] = lba % CD_FRAMES;
  553. }
  554. int init_drive(char *dev)
  555. {
  556. unsigned char msf_ent[3];
  557. /*
  558. * open the device
  559. */
  560. drive=open(dev,0);
  561. if (drive<0) return (-1);
  562. /*
  563. * get TocHeader
  564. */
  565. printf("getting TocHeader...\n");
  566. rc=ioctl(drive,CDROMREADTOCHDR,&hdr);
  567. if (rc!=0)
  568. {
  569. printf("can't get TocHeader (error %d).\n",rc);
  570. return (-2);
  571. }
  572. else
  573. first=hdr.cdth_trk0;
  574. last=hdr.cdth_trk1;
  575. printf("TocHeader: %d %d\n",hdr.cdth_trk0,hdr.cdth_trk1);
  576. /*
  577. * get and display all TocEntries
  578. */
  579. printf("getting TocEntries...\n");
  580. for (i=1;i<=hdr.cdth_trk1+1;i++)
  581. {
  582. if (i!=hdr.cdth_trk1+1) TocEntry[i].cdte_track = i;
  583. else TocEntry[i].cdte_track = CDROM_LEADOUT;
  584. TocEntry[i].cdte_format = CDROM_LBA;
  585. rc=ioctl(drive,CDROMREADTOCENTRY,&TocEntry[i]);
  586. if (rc!=0)
  587. {
  588. printf("can't get TocEntry #%d (error %d).\n",i,rc);
  589. }
  590. else
  591. {
  592. lba2msf(TocEntry[i].cdte_addr.lba,&msf_ent[0]);
  593. if (TocEntry[i].cdte_track==CDROM_LEADOUT)
  594. {
  595. printf("TocEntry #%02X: %1X %1X %02d:%02d:%02d (lba: 0x%06X) %02X\n",
  596. TocEntry[i].cdte_track,
  597. TocEntry[i].cdte_adr,
  598. TocEntry[i].cdte_ctrl,
  599. msf_ent[0],
  600. msf_ent[1],
  601. msf_ent[2],
  602. TocEntry[i].cdte_addr.lba,
  603. TocEntry[i].cdte_datamode);
  604. }
  605. else
  606. {
  607. printf("TocEntry #%02d: %1X %1X %02d:%02d:%02d (lba: 0x%06X) %02X\n",
  608. TocEntry[i].cdte_track,
  609. TocEntry[i].cdte_adr,
  610. TocEntry[i].cdte_ctrl,
  611. msf_ent[0],
  612. msf_ent[1],
  613. msf_ent[2],
  614. TocEntry[i].cdte_addr.lba,
  615. TocEntry[i].cdte_datamode);
  616. }
  617. }
  618. }
  619. return (hdr.cdth_trk1); /* number of tracks */
  620. }
  621. void display(int size,unsigned char *buffer)
  622. {
  623. k=0;
  624. getchar();
  625. for (i=0;i<(size+1)/16;i++)
  626. {
  627. printf("%4d:",i*16);
  628. for (j=0;j<16;j++)
  629. {
  630. printf(" %02X",buffer[i*16+j]);
  631. }
  632. printf(" ");
  633. for (j=0;j<16;j++)
  634. {
  635. if (isalnum(buffer[i*16+j]))
  636. printf("%c",buffer[i*16+j]);
  637. else
  638. printf(".");
  639. }
  640. printf("\n");
  641. k++;
  642. if (k>=20)
  643. {
  644. printf("press ENTER to continue\n");
  645. getchar();
  646. k=0;
  647. }
  648. }
  649. }
  650. int main(int argc, char *argv[])
  651. {
  652. printf("\nTesting tool for a CDROM driver's audio functions V0.1\n");
  653. printf("(C) 1995 Eberhard Moenkeberg <emoenke@gwdg.de>\n");
  654. printf("initializing...\n");
  655. rc=init_drive(default_device);
  656. if (rc<0) printf("could not open %s (rc=%d).\n",default_device,rc);
  657. help();
  658. while (1)
  659. {
  660. printf("Give a one-letter command (h = help): ");
  661. scanf("%s",command);
  662. command[1]=0;
  663. switch (command[0])
  664. {
  665. case 'D':
  666. printf("device name (f.e. /dev/sbpcd3): ? ");
  667. scanf("%s",&dev);
  668. close(drive);
  669. rc=init_drive(dev);
  670. if (rc<0) printf("could not open %s (rc %d).\n",dev,rc);
  671. break;
  672. case 'e':
  673. rc=ioctl(drive,CDROMEJECT);
  674. if (rc<0) printf("CDROMEJECT: rc=%d.\n",rc);
  675. break;
  676. case 'p':
  677. rc=ioctl(drive,CDROMPAUSE);
  678. if (rc<0) printf("CDROMPAUSE: rc=%d.\n",rc);
  679. break;
  680. case 'r':
  681. rc=ioctl(drive,CDROMRESUME);
  682. if (rc<0) printf("CDROMRESUME: rc=%d.\n",rc);
  683. break;
  684. case 's':
  685. rc=ioctl(drive,CDROMSTOP);
  686. if (rc<0) printf("CDROMSTOP: rc=%d.\n",rc);
  687. break;
  688. case 'S':
  689. rc=ioctl(drive,CDROMSTART);
  690. if (rc<0) printf("CDROMSTART: rc=%d.\n",rc);
  691. break;
  692. case 't':
  693. rc=ioctl(drive,CDROMREADTOCHDR,&tocHdr);
  694. if (rc<0)
  695. {
  696. printf("CDROMREADTOCHDR: rc=%d.\n",rc);
  697. break;
  698. }
  699. first=tocHdr.cdth_trk0;
  700. last= tocHdr.cdth_trk1;
  701. if ((first==0)||(first>last))
  702. {
  703. printf ("--got invalid TOC data.\n");
  704. }
  705. else
  706. {
  707. printf("--enter track number(first=%d, last=%d): ",first,last);
  708. scanf("%d",&i1);
  709. ti.cdti_trk0=i1;
  710. if (ti.cdti_trk0<first) ti.cdti_trk0=first;
  711. if (ti.cdti_trk0>last) ti.cdti_trk0=last;
  712. ti.cdti_ind0=0;
  713. ti.cdti_trk1=last;
  714. ti.cdti_ind1=0;
  715. rc=ioctl(drive,CDROMSTOP);
  716. rc=ioctl(drive,CDROMPLAYTRKIND,&ti);
  717. if (rc<0) printf("CDROMPLAYTRKIND: rc=%d.\n",rc);
  718. }
  719. break;
  720. case 'n':
  721. rc=ioctl(drive,CDROMSTOP);
  722. if (++ti.cdti_trk0>last) ti.cdti_trk0=last;
  723. ti.cdti_ind0=0;
  724. ti.cdti_trk1=last;
  725. ti.cdti_ind1=0;
  726. rc=ioctl(drive,CDROMPLAYTRKIND,&ti);
  727. if (rc<0) printf("CDROMPLAYTRKIND: rc=%d.\n",rc);
  728. break;
  729. case 'l':
  730. rc=ioctl(drive,CDROMSTOP);
  731. if (--ti.cdti_trk0<first) ti.cdti_trk0=first;
  732. ti.cdti_ind0=0;
  733. ti.cdti_trk1=last;
  734. ti.cdti_ind1=0;
  735. rc=ioctl(drive,CDROMPLAYTRKIND,&ti);
  736. if (rc<0) printf("CDROMPLAYTRKIND: rc=%d.\n",rc);
  737. break;
  738. case 'c':
  739. subchnl.cdsc_format=CDROM_MSF;
  740. rc=ioctl(drive,CDROMSUBCHNL,&subchnl);
  741. if (rc<0) printf("CDROMSUBCHNL: rc=%d.\n",rc);
  742. else
  743. {
  744. printf("AudioStatus:%s Track:%d Mode:%d MSF=%02d:%02d:%02d\n",
  745. subchnl.cdsc_audiostatus==CDROM_AUDIO_PLAY ? "PLAYING":"NOT PLAYING",
  746. subchnl.cdsc_trk,subchnl.cdsc_adr,
  747. subchnl.cdsc_absaddr.msf.minute,
  748. subchnl.cdsc_absaddr.msf.second,
  749. subchnl.cdsc_absaddr.msf.frame);
  750. }
  751. break;
  752. case 'i':
  753. printf("Track No.: ");
  754. scanf("%d",&i1);
  755. entry.cdte_track=i1;
  756. if (entry.cdte_track<first) entry.cdte_track=first;
  757. if (entry.cdte_track>last) entry.cdte_track=last;
  758. entry.cdte_format=CDROM_MSF;
  759. rc=ioctl(drive,CDROMREADTOCENTRY,&entry);
  760. if (rc<0) printf("CDROMREADTOCENTRY: rc=%d.\n",rc);
  761. else
  762. {
  763. printf("Mode %d Track, starts at %02d:%02d:%02d\n",
  764. entry.cdte_adr,
  765. entry.cdte_addr.msf.minute,
  766. entry.cdte_addr.msf.second,
  767. entry.cdte_addr.msf.frame);
  768. }
  769. break;
  770. case 'a':
  771. printf("Address (min:sec:frm) ");
  772. scanf("%d:%d:%d",&i1,&i2,&i3);
  773. msf.cdmsf_min0=i1;
  774. msf.cdmsf_sec0=i2;
  775. msf.cdmsf_frame0=i3;
  776. if (msf.cdmsf_sec0>59) msf.cdmsf_sec0=59;
  777. if (msf.cdmsf_frame0>74) msf.cdmsf_frame0=74;
  778. lba2msf(TocEntry[last+1].cdte_addr.lba-1,&msf.cdmsf_min1);
  779. rc=ioctl(drive,CDROMSTOP);
  780. rc=ioctl(drive,CDROMPLAYMSF,&msf);
  781. if (rc<0) printf("CDROMPLAYMSF: rc=%d.\n",rc);
  782. break;
  783. case 'V':
  784. rc=ioctl(drive,CDROMVOLREAD,&volctrl);
  785. if (rc<0) printf("CDROMVOLCTRL: rc=%d.\n",rc);
  786. printf("Volume: channel 0 (left) %d, channel 1 (right) %d\n",volctrl.channel0,volctrl.channel1);
  787. break;
  788. case 'R':
  789. rc=ioctl(drive,CDROMRESET);
  790. if (rc<0) printf("CDROMRESET: rc=%d.\n",rc);
  791. break;
  792. #ifdef AZT_PRIVATE_IOCTLS /*not supported by every CDROM driver*/
  793. case 'd':
  794. printf("Address (min:sec:frm) ");
  795. scanf("%d:%d:%d",&i1,&i2,&i3);
  796. azt.msf.cdmsf_min0=i1;
  797. azt.msf.cdmsf_sec0=i2;
  798. azt.msf.cdmsf_frame0=i3;
  799. if (azt.msf.cdmsf_sec0>59) azt.msf.cdmsf_sec0=59;
  800. if (azt.msf.cdmsf_frame0>74) azt.msf.cdmsf_frame0=74;
  801. rc=ioctl(drive,CDROMREADMODE1,&azt.msf);
  802. if (rc<0) printf("CDROMREADMODE1: rc=%d.\n",rc);
  803. else display(CD_FRAMESIZE,azt.buf);
  804. break;
  805. case 'w':
  806. printf("Address (min:sec:frame) ");
  807. scanf("%d:%d:%d",&i1,&i2,&i3);
  808. azt.msf.cdmsf_min0=i1;
  809. azt.msf.cdmsf_sec0=i2;
  810. azt.msf.cdmsf_frame0=i3;
  811. if (azt.msf.cdmsf_sec0>59) azt.msf.cdmsf_sec0=59;
  812. if (azt.msf.cdmsf_frame0>74) azt.msf.cdmsf_frame0=74;
  813. rc=ioctl(drive,CDROMREADMODE2,&azt.msf);
  814. if (rc<0) printf("CDROMREADMODE2: rc=%d.\n",rc);
  815. else display(CD_FRAMESIZE_RAW,azt.buf); /* currently only 2336 */
  816. break;
  817. #endif
  818. case 'v':
  819. printf("--Channel 0 (Left) (0-255): ");
  820. scanf("%d",&i1);
  821. volctrl.channel0=i1;
  822. printf("--Channel 1 (Right) (0-255): ");
  823. scanf("%d",&i1);
  824. volctrl.channel1=i1;
  825. volctrl.channel2=0;
  826. volctrl.channel3=0;
  827. rc=ioctl(drive,CDROMVOLCTRL,&volctrl);
  828. if (rc<0) printf("CDROMVOLCTRL: rc=%d.\n",rc);
  829. break;
  830. case 'q':
  831. close(drive);
  832. exit(0);
  833. case 'h':
  834. help();
  835. break;
  836. case 'T': /* display TOC entry - without involving the driver */
  837. scanf("%d",&i);
  838. if ((i<hdr.cdth_trk0)||(i>hdr.cdth_trk1))
  839. printf("invalid track number.\n");
  840. else
  841. printf("TocEntry %02d: adr=%01X ctrl=%01X msf=%02d:%02d:%02d mode=%02X\n",
  842. TocEntry[i].cdte_track,
  843. TocEntry[i].cdte_adr,
  844. TocEntry[i].cdte_ctrl,
  845. TocEntry[i].cdte_addr.msf.minute,
  846. TocEntry[i].cdte_addr.msf.second,
  847. TocEntry[i].cdte_addr.msf.frame,
  848. TocEntry[i].cdte_datamode);
  849. break;
  850. case 'A': /* read audio data into file */
  851. printf("Address (min:sec:frm) ? ");
  852. scanf("%d:%d:%d",&i1,&i2,&i3);
  853. read_audio.addr.msf.minute=i1;
  854. read_audio.addr.msf.second=i2;
  855. read_audio.addr.msf.frame=i3;
  856. read_audio.addr_format=CDROM_MSF;
  857. printf("# of frames ? ");
  858. scanf("%d",&i1);
  859. read_audio.nframes=i1;
  860. k=read_audio.nframes*CD_FRAMESIZE_RAW;
  861. read_audio.buf=malloc(k);
  862. if (read_audio.buf==NULL)
  863. {
  864. printf("can't malloc %d bytes.\n",k);
  865. break;
  866. }
  867. sprintf(filename,"audio_%02d%02d%02d_%02d.%02d\0",
  868. read_audio.addr.msf.minute,
  869. read_audio.addr.msf.second,
  870. read_audio.addr.msf.frame,
  871. read_audio.nframes,
  872. ++sequence);
  873. datafile=creat(filename, 0755);
  874. if (datafile<0)
  875. {
  876. printf("can't open datafile %s.\n",filename);
  877. break;
  878. }
  879. rc=ioctl(drive,CDROMREADAUDIO,&read_audio);
  880. if (rc!=0)
  881. {
  882. printf("CDROMREADAUDIO: rc=%d.\n",rc);
  883. }
  884. else
  885. {
  886. rc=write(datafile,&read_audio.buf,k);
  887. if (rc!=k) printf("datafile I/O error (%d).\n",rc);
  888. }
  889. close(datafile);
  890. break;
  891. case 'X': /* set EJECT_SW (0: disable, 1: enable auto-ejecting) */
  892. scanf("%d",&i);
  893. rc=ioctl(drive,CDROMEJECT_SW,i);
  894. if (rc!=0)
  895. printf("CDROMEJECT_SW: rc=%d.\n",rc);
  896. else
  897. printf("EJECT_SW set to %d\n",i);
  898. break;
  899. case 'M': /* get the multisession redirection info */
  900. ms_info.addr_format=CDROM_LBA;
  901. rc=ioctl(drive,CDROMMULTISESSION,&ms_info);
  902. if (rc!=0)
  903. {
  904. printf("CDROMMULTISESSION(lba): rc=%d.\n",rc);
  905. }
  906. else
  907. {
  908. if (ms_info.xa_flag) printf("MultiSession offset (lba): %d (0x%06X)\n",ms_info.addr.lba,ms_info.addr.lba);
  909. else
  910. {
  911. printf("this CD is not an XA disk.\n");
  912. break;
  913. }
  914. }
  915. ms_info.addr_format=CDROM_MSF;
  916. rc=ioctl(drive,CDROMMULTISESSION,&ms_info);
  917. if (rc!=0)
  918. {
  919. printf("CDROMMULTISESSION(msf): rc=%d.\n",rc);
  920. }
  921. else
  922. {
  923. if (ms_info.xa_flag)
  924. printf("MultiSession offset (msf): %02d:%02d:%02d (0x%02X%02X%02X)\n",
  925. ms_info.addr.msf.minute,
  926. ms_info.addr.msf.second,
  927. ms_info.addr.msf.frame,
  928. ms_info.addr.msf.minute,
  929. ms_info.addr.msf.second,
  930. ms_info.addr.msf.frame);
  931. else printf("this CD is not an XA disk.\n");
  932. }
  933. break;
  934. #ifdef SBP_PRIVATE_IOCTLS
  935. case 'Y': /* set the driver's message level */
  936. #if 0 /* not implemented yet */
  937. printf("enter switch name (f.e. DBG_CMD): ");
  938. scanf("%s",&dbg_switch);
  939. j=get_dbg_num(dbg_switch);
  940. #else
  941. printf("enter DDIOCSDBG switch number: ");
  942. scanf("%d",&j);
  943. #endif
  944. printf("enter 0 for \"off\", 1 for \"on\": ");
  945. scanf("%d",&i);
  946. if (i==0) j|=0x80;
  947. printf("calling \"ioctl(drive,DDIOCSDBG,%d)\"\n",j);
  948. rc=ioctl(drive,DDIOCSDBG,j);
  949. printf("DDIOCSDBG: rc=%d.\n",rc);
  950. break;
  951. case 'Z': /* set the audio buffer size */
  952. printf("# frames wanted: ? ");
  953. scanf("%d",&j);
  954. rc=ioctl(drive,CDROMAUDIOBUFSIZ,j);
  955. printf("%d frames granted.\n",rc);
  956. break;
  957. #endif /* SBP_PRIVATE_IOCTLS */
  958. default:
  959. printf("unknown command: \"%s\".\n",command);
  960. break;
  961. }
  962. }
  963. return 0;
  964. }
  965. /*==========================================================================*/