diskid.c
上传用户:xiejiait
上传日期:2007-01-06
资源大小:881k
文件大小:15k
- /* @(#)diskid.c 1.20 00/01/13 Copyright 1998 J. Schilling */
- #ifndef lint
- static char sccsid[] =
- "@(#)diskid.c 1.20 00/01/13 Copyright 1998 J. Schilling";
- #endif
- /*
- * Disk Idientification Method
- *
- * Copyright (c) 1998 J. Schilling
- */
- /*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- */
- #include <mconfig.h>
- #include <stdio.h>
- #include <standard.h>
- #include <sys/types.h>
- #include <utypes.h>
- #include "cdrecord.h"
- EXPORT void pr_manufacturer __PR((msf_t *mp, BOOL rw, BOOL audio));
- EXPORT int manufacturer_id __PR((msf_t *mp));
- EXPORT long disk_rcap __PR((msf_t *mp, long maxblock, BOOL rw, BOOL audio));
- struct disk_man {
- msf_t mi_msf;
- char mi_num;
- char *mi_name;
- };
- /*
- * Illegal (old) Manufacturer.
- */
- LOCAL char m_ill[] = "Unknown old Manufacturer code";
- /*
- * Permanent codes.
- */
- LOCAL char m_kingpro[] = "King Pro Mediatek Inc.";
- LOCAL char m_custpo[] = "Customer Pressing Oosterhout";
- LOCAL char m_taeil[] = "Taeil Media Co.,Ltd.";
- LOCAL char m_doremi[] = "Doremi Media Co., Ltd.";
- LOCAL char m_xcitec[] = "Xcitec Inc.";
- LOCAL char m_leaddata[] = "Lead Data Inc.";
- LOCAL char m_fuji[] = "FUJI Photo Film Co., Ltd.";
- LOCAL char m_hitachi[] = "Hitachi Maxell, Ltd.";
- LOCAL char m_kodakjp[] = "Kodak Japan Limited";
- LOCAL char m_mitsui[] = "Mitsui Chemicals, Inc.";
- LOCAL char m_pioneer[] = "Pioneer Video Corporation";
- LOCAL char m_plasmon[] = "Plasmon Data systems Ltd.";
- LOCAL char m_princo[] = "Princo Corporation";
- LOCAL char m_ricoh[] = "Ricoh Company Limited";
- LOCAL char m_skc[] = "SKC Co., Ltd.";
- LOCAL char m_tyuden[] = "Taiyo Yuden Company Limited";
- LOCAL char m_tdk[] = "TDK Corporation";
- LOCAL char m_mitsubishi[] = "Mitsubishi Chemical Corporation";
- LOCAL char m_auvistar[] = "Auvistar Industry Co.,Ltd.";
- LOCAL char m_gigastore[] = "GIGASTORAGE CORPORATION";
- LOCAL char m_fornet[] = "FORNET INTERNATIONAL PTE LTD.";
- LOCAL char m_cmc[] = "CMC Magnetics Corporation";
- LOCAL char m_odm[] = "Optical Disc Manufacturing Equipment";
- LOCAL char m_ritek[] = "Ritek Co.";
- /*
- * Tentative codes.
- */
- LOCAL char m_hile[] = "Hile Optical Disc Technology Corp.";
- LOCAL char m_friendly[] = "Friendly CD-Tek Co.";
- LOCAL char m_soundsound[] = "Sound Sound Multi-Media Development Limited";
- LOCAL char m_kdg[] = "kdg mediatech AG";
- LOCAL char m_seantram[] = "Seantram Technology Inc.";
- LOCAL char m_eximpo[] = "EXIMPO";
- LOCAL char m_delphi[] = "DELPHI TECHNOLOGY INC.";
- LOCAL char m_harmonic[] = "Harmonic Hall Optical Disc Ltd.";
- LOCAL char m_guannyinn[] = "Guann Yinn Co.,Ltd.";
- LOCAL char m_optime[] = "Opti.Me.S. S.p.A.";
- LOCAL char m_nacar[] = "Nacar Media srl";
- LOCAL char m_optrom[] = "OPTROM.INC.";
- LOCAL char m_audiodis[] = "AUDIO DISTRIBUTORS CO., LTD.";
- LOCAL char m_acer[] = "Acer Media Technology, Inc.";
- LOCAL char m_woongjin[] = "Woongjin Media corp";
- LOCAL char m_infodisk[] = "INFODISC Technology Co., Ltd.";
- LOCAL char m_unitech[] = "UNITECH JAPAN INC.";
- LOCAL char m_ams[] = "AMS Technology Inc.";
- LOCAL char m_vanguard[] = "Vanguard Disc Inc.";
- LOCAL char m_grandadv[] = "Grand Advance Technology Ltd.";
- LOCAL char m_digitalstor[] = "DIGITAL STORAGE TECHNOLOGY CO.,LTD";
- LOCAL char m_matsushita[] = "Matsushita Electric Industrial Co.,Ltd.";
- LOCAL char m_albrechts[] = "CDA Datentr鋑er Albrechts GmbH.";
- LOCAL char m_xalbrechts[] = "??? CDA Datentr鋑er Albrechts GmbH.";
- LOCAL char m_prodisc[] = "Prodisc Technology Inc.";
- LOCAL char m_postech[] = "POSTECH Corporation";
- #ifdef used
- LOCAL char m_ncolumbia[] = "NIPPON COLUMBIA CO.,LTD.";
- #endif
- LOCAL char m_odc[] = "OPTICAL DISC CORPRATION";
- LOCAL char m_sony[] = "SONY Corporation";
- LOCAL char m_cis[] = "CIS Technology Inc.";
- LOCAL char m_csitaly[] = "Computer Support Italy s.r.l.";
- LOCAL char m_mmmm[] = "Multi Media Masters & Machinary SA";
- /*
- * Guessed codes.
- */
- /*LOCAL char m_seantram[] = "Seantram Technology Inc.";*/
- /*
- * Old (illegal) code table. It lists single specific codes (97:xx:yy).
- */
- LOCAL struct disk_man odman[] = {
- /*
- * Illegal (old) codes.
- */
- {{97, 25, 00}, 80, "ILLEGAL: TDK ???" },
- {{97, 25, 15}, 0, m_ill },
- {{97, 27, 00}, 81, "ILLEGAL: Old Ritek Co.???" },
- {{97, 27, 25}, 0, m_ill },
- {{97, 30, 00}, 0, m_ill },
- {{97, 33, 00}, 82, "ILLEGAL: Old CDA Datentr鋑er Albrechts GmbH." },
- {{97, 35, 44}, 0, m_ill },
- {{97, 39, 00}, 0, m_ill },
- {{97, 45, 36}, 0, "ILLEGAL: Old Kodak Photo CD" },
- {{97, 47, 00}, 0, m_ill },
- {{97, 47, 30}, 0, m_ill },
- {{97, 48, 14}, 0, m_ill },
- {{97, 48, 33}, 0, m_ill },
- {{97, 49, 00}, 0, m_ill },
- {{97, 54, 00}, 0, m_ill },
- {{97, 55, 06}, 0, m_ill },
- {{97, 57, 00}, 0, m_ill },
- /*
- * List end marker
- */
- {{00, 00, 00}, 0, NULL },
- };
- /*
- * Actual code table. It lists code ranges (97:xx:y0 - 97:xx:y9).
- *
- * Note that dp->mi_msf.msf_frame needs to be always rounded down
- * to 0 even for media that has e.g. 97:27/01 in the official table.
- */
- LOCAL struct disk_man dman[] = {
- /*
- * Permanent codes.
- */
- {{97, 28, 40}, 36, m_kingpro },
- {{97, 23, 60}, 49, m_custpo },
- {{97, 29, 00}, 37, m_taeil },
- {{97, 26, 10}, 19, m_postech },
- {{97, 47, 40}, 19, m_postech },
- {{97, 24, 10}, 24, m_sony },
- /* {{97, 46, 10}, 24, m_sony },*/
- {{97, 23, 10}, 33, m_doremi },
- {{97, 25, 60}, 30, m_xcitec },
- {{97, 45, 60}, 30, m_xcitec },
- {{97, 26, 50}, 10, m_leaddata },
- {{97, 48, 60}, 10, m_leaddata },
- {{97, 26, 40}, 6, m_fuji },
- {{97, 46, 40}, 6, m_fuji },
- {{97, 25, 20}, 8, m_hitachi },
- {{97, 47, 10}, 8, m_hitachi },
- {{97, 27, 40}, 9, m_kodakjp },
- {{97, 48, 10}, 9, m_kodakjp },
- {{97, 27, 50}, 12, m_mitsui },
- {{97, 48, 50}, 12, m_mitsui },
- {{97, 27, 30}, 17, m_pioneer },
- {{97, 48, 30}, 17, m_pioneer },
- {{97, 27, 10}, 18, m_plasmon },
- {{97, 48, 20}, 18, m_plasmon },
- {{97, 27, 20}, 20, m_princo },
- {{97, 47, 20}, 20, m_princo },
- {{97, 27, 60}, 21, m_ricoh },
- {{97, 48, 00}, 21, m_ricoh },
- {{97, 26, 20}, 23, m_skc },
- {{97, 24, 00}, 25, m_tyuden },
- {{97, 46, 00}, 25, m_tyuden },
- {{97, 32, 00}, 26, m_tdk },
- {{97, 49, 00}, 26, m_tdk },
- {{97, 34, 20}, 11, m_mitsubishi },
- {{97, 50, 20}, 11, m_mitsubishi },
- {{97, 28, 30}, 1, m_auvistar },
- {{97, 46, 50}, 1, m_auvistar },
- {{97, 28, 10}, 7, m_gigastore },
- {{97, 49, 10}, 7, m_gigastore },
- {{97, 26, 00}, 5, m_fornet },
- {{97, 45, 00}, 5, m_fornet },
- {{97, 26, 60}, 3, m_cmc },
- {{97, 46, 60}, 3, m_cmc },
- {{97, 21, 40}, 16, m_odm },
- {{97, 31, 00}, 22, m_ritek },
- {{97, 47, 50}, 22, m_ritek },
- {{97, 28, 20}, 13, m_mmmm },
- {{97, 46, 20}, 13, m_mmmm },
- {{97, 32, 10}, 27, m_prodisc },
- /*
- * Tentative codes.
- */
- {{97, 29, 30}, 57, m_hile },
- {{97, 51, 50}, 57, m_hile },
- {{97, 28, 60}, 56, m_friendly },
- {{97, 21, 50}, 55, m_soundsound },
- {{97, 24, 40}, 54, m_kdg },
- {{97, 22, 10}, 53, m_seantram },
- {{97, 22, 30}, 52, m_eximpo },
- {{97, 28, 50}, 51, m_delphi },
- {{97, 29, 00}, 50, m_harmonic },
- {{97, 15, 10}, 22, m_ritek },
- {{97, 45, 50}, 48, m_guannyinn },
- {{97, 24, 50}, 48, m_guannyinn },
- {{97, 49, 30}, 47, m_optime },
- {{97, 28, 00}, 47, m_optime },
- {{97, 23, 20}, 46, m_nacar },
- {{97, 23, 50}, 45, m_optrom },
- {{97, 23, 30}, 44, m_audiodis },
- {{97, 22, 60}, 43, m_acer },
- {{97, 45, 20}, 43, m_acer },
- {{97, 15, 00}, 26, m_tdk },
- {{97, 15, 20}, 11, m_mitsubishi },
- {{97, 22, 00}, 39, m_woongjin },
- {{97, 25, 30}, 40, m_infodisk },
- {{97, 51, 20}, 40, m_infodisk },
- {{97, 24, 30}, 41, m_unitech },
- {{97, 25, 50}, 42, m_ams },
- {{97, 29, 10}, 38, m_vanguard },
- {{97, 50, 10}, 38, m_vanguard },
- {{97, 31, 30}, 35, m_grandadv },
- {{97, 51, 10}, 35, m_grandadv },
- {{97, 49, 20}, 36, m_kingpro },
- {{97, 27, 00}, 34, m_digitalstor }, /* in reality 27/01 */
- {{97, 48, 40}, 34, m_digitalstor }, /* XXX was m_ncolumbia */
- {{97, 23, 00}, 31, m_matsushita },
- {{97, 49, 60}, 31, m_matsushita },
- {{97, 30, 10}, 32, m_albrechts }, /* XXX was m_ncolumbia */
- {{97, 50, 30}, 32, m_albrechts },
- {{97, 47, 60}, 27, m_prodisc },
- /* {{97, 30, 10}, 14, m_ncolumbia },*/
- /* {{97, 48, 40}, 14, m_ncolumbia },*/
- {{97, 26, 30}, 15, m_odc },
- {{97, 22, 40}, 2, m_cis },
- {{97, 45, 40}, 2, m_cis },
- {{97, 24, 20}, 4, m_csitaly },
- {{97, 46, 30}, 4, m_csitaly },
- /*
- * Guessed codes.
- */
- {{97, 20, 10}, 32, m_xalbrechts }, /* XXX guess */
- {{97, 23, 40}, 32, m_xalbrechts }, /* XXX guess */
- {{97, 24, 40}, 29, "????? Princo Corporation" }, /* XXX guess */
- {{97, 28, 00}, 28, "?????" }, /* XXX guess */
- /*
- * List end marker
- */
- {{00, 00, 00}, 0, NULL },
- };
- EXPORT void
- pr_manufacturer(mp, rw, audio)
- msf_t *mp;
- BOOL rw;
- BOOL audio;
- {
- struct disk_man * dp;
- int frame;
- int type;
- char *tname;
- /* printf("pr_manufacturer rw: %d audio: %dn", rw, audio);*/
- type = mp->msf_frame % 10;
- frame = mp->msf_frame - type;
- if (type < 5) {
- tname = "Long strategy type (Cyanine, AZO or similar)";
- } else {
- tname = "Short strategy type (Phthalocyanine or similar)";
- }
- dp = odman;
- while (dp->mi_msf.msf_min != 0) {
- if (mp->msf_min == dp->mi_msf.msf_min &&
- mp->msf_sec == dp->mi_msf.msf_sec &&
- mp->msf_frame == dp->mi_msf.msf_frame) {
- /*
- * Note that dp->mi_msf.msf_frame is always rounded
- * down to 0 even for media that has 97:27/01 in the
- * official table.
- */
- if (!rw)
- printf("Disk type unknownn");
- else
- printf("Disk type: phase changen");
- printf("Manuf. index: %dn", dp->mi_num);
- printf("Manufacturer: %sn", dp->mi_name);
- return;
- }
- dp++;
- }
- dp = dman;
- while (dp->mi_msf.msf_min != 0) {
- if (mp->msf_min == dp->mi_msf.msf_min &&
- mp->msf_sec == dp->mi_msf.msf_sec &&
- frame == dp->mi_msf.msf_frame) {
- if (!rw)
- printf("Disk type: %sn", tname);
- else
- printf("Disk type: phase changen");
- printf("Manuf. index: %dn", dp->mi_num);
- printf("Manufacturer: %sn", dp->mi_name);
- return;
- }
- dp++;
- }
- printf("Disk type unknownn");
- printf("Manufacturer unknown (not in table)n");
- }
- EXPORT int
- manufacturer_id(mp)
- msf_t *mp;
- {
- struct disk_man * dp;
- int frame;
- int type;
- type = mp->msf_frame % 10;
- frame = mp->msf_frame - type;
- dp = odman;
- while (dp->mi_msf.msf_min != 0) {
- if (mp->msf_min == dp->mi_msf.msf_min &&
- mp->msf_sec == dp->mi_msf.msf_sec &&
- mp->msf_frame == dp->mi_msf.msf_frame) {
- return (dp->mi_num);
- }
- dp++;
- }
- dp = dman;
- while (dp->mi_msf.msf_min != 0) {
- if (mp->msf_min == dp->mi_msf.msf_min &&
- mp->msf_sec == dp->mi_msf.msf_sec &&
- frame == dp->mi_msf.msf_frame) {
- /*
- * Note that dp->mi_msf.msf_frame is always rounded
- * down to 0 even for media that has 97:27/01 in the
- * official table.
- */
- return (dp->mi_num);
- }
- dp++;
- }
- return (-1);
- }
- struct disk_rcap {
- msf_t ci_msf;
- long ci_cap;
- long ci_rcap;
- };
- LOCAL struct disk_rcap rcap[] = {
- {{97, 31, 00}, 359849, 368923 }, /*! Arita CD-R 80 */
- {{97, 26, 50}, 359849, 369096 }, /*! Lead Data CD-R 80 */
- {{97, 26, 12}, 359849, 368000 }, /*X POSTECH 80 Min */
- {{97, 25, 00}, 359849, 374002 }, /* TDK 80 Minuten */
- {{97, 20, 14}, 359700, 376386 }, /*! Albrechts DataFile Plus */
- {{97, 35, 44}, 359100, 368791 }, /*! NoName BC-1 700 Mb/80 Min */
- {{97, 26, 60}, 337350, 349030 }, /* Koch gr黱 CD-R74PRO */
- {{97, 26, 50}, 337050, 351205 }, /* Saba */
- {{97, 26, 00}, 337050, 351411 }, /*!DGN (FORNET) */
- {{97, 22, 40}, 336631, 349971 }, /* Targa gr黱 CD-R74 */
- {{97, 26, 50}, 336631, 351727 }, /*! Sunstar (Lead Data) */
- {{97, 26, 55}, 336631, 350474 }, /*! NoName ZAP (Lead Data) */
- {{97, 27, 28}, 336601, 346489 }, /*! BTC CD-R (Princo) */
- {{97, 27, 30}, 336601, 351646 }, /*! Pioneer blau CDM-W74S */
- {{97, 27, 31}, 336601, 351379 }, /* Pioneer blau CDM-W74S */
- {{97, 27, 33}, 336601, 347029 }, /*! Pioneer braun CDM-V74S */
- {{97, 26, 40}, 336225, 346210 }, /* Fuji Silver Disk */
- {{97, 28, 10}, 336225, 348757 }, /*!GigaStorage Cursor CD-R */
- {{97, 31, 00}, 336225, 345460 }, /* Arita gr黱 */
- {{97, 25, 28}, 336075, 352879 }, /* Maxell gold CD-R74G */
- {{97, 24, 01}, 336075, 346856 }, /*!Philips Premium Silver */
- {{97, 24, 00}, 336075, 346741 }, /* Philips gr黱 CD-R74 */
- {{97, 22, 41}, 335206, 349385 }, /* Octek gr黱 */
- {{97, 34, 20}, 335100, 342460 }, /* Verbatim DataLifePlus */
- {{97, 33, 00}, 335100, 344634 }, /*!ITS Singapore (braun/gr黱)*/
- {{97, 32, 19}, 335100, 343921 }, /*!Prodisc silber/silber */
- {{97, 25, 21}, 335100, 346013 }, /* Maxell gr黱 CD-R74XL */
- {{97, 27, 00}, 335100, 353448 }, /* TDK gr黱 CD-RXG74 */
- {{97, 27, 31}, 335100, 351862 }, /*!Maxell CD-R74MU (Musik) */
- {{97, 27, 33}, 335100, 351336 }, /* Pioneer RDD-74A */
- {{97, 26, 60}, 334259, 349036 }, /* BASF gr黱 */
- {{97, 28, 21}, 333976, 348217 }, /*! Noname-B (MMMM) */
- {{97, 28, 20}, 333976, 346485 }, /* Koch gr黱 CD-R74 PRO */
- {{97, 32, 00}, 333975, 345736 }, /* Imation 3M */
- {{97, 32, 00}, 333975, 348835 }, /* TDK Reflex X CD-R74 */
- {{97, 30, 18}, 333899, 344857 }, /* HiSpace gr黱 */
- {{97, 27, 66}, 333750, 352726 }, /*!Philips Megalife (Musik) */
- {{97, 28, 43}, 333750, 345344 }, /*!MMore CD-R */
- {{97, 27, 65}, 333750, 348343 }, /* Ricoh gold */
- {{97, 27, 00}, 333750, 336246 }, /* BestMedia gr黱 CD-R74 */
- {{97, 27, 28}, 333491, 347473 }, /* Fuji gr黱 (alt) */
- {{97, 24, 48}, 333491, 343519 }, /* BASF (alt) */
- {{97, 27, 55}, 333235, 343270 }, /* Teac gold CD-R74 */
- {{97, 27, 45}, 333226, 343358 }, /* Kodak gold */
- {{97, 28, 20}, 333226, 346483 }, /* SAST gr黱 */
- {{97, 27, 45}, 333226, 343357 }, /* Mitsumi gold */
- {{97, 28, 25}, 333226, 346481 }, /* Cedar Gr黱 */
- {{97, 23, 00}, 333226, 346206 }, /* Fuji gr黱 (alt) */
- {{97, 33, 00}, 333225, 349623 }, /* DataFile Albrechts */
- {{97, 24, 24}, 333198, 342536 }, /*!SUN CD Recordable */
- {{97, 27, 19}, 332850, 348442 }, /* Plasmon gold PCD-R74 */
- {{97, 32, 00}, 96600, 106502 }, /* TDK 80mm (for music only) */
- /*
- * List end marker
- */
- {{00, 00, 00}, 0L, 0L },
- };
- EXPORT long
- disk_rcap(mp, maxblock, rw, audio)
- msf_t *mp;
- long maxblock;
- BOOL rw;
- BOOL audio;
- {
- struct disk_rcap * dp;
- dp = rcap;
- while (dp->ci_msf.msf_min != 0) {
- if (mp->msf_min == dp->ci_msf.msf_min &&
- mp->msf_sec == dp->ci_msf.msf_sec &&
- mp->msf_frame == dp->ci_msf.msf_frame &&
- maxblock == dp->ci_cap)
- return (dp->ci_rcap);
- dp++;
- }
- return (0L);
- }