Ignore:
Timestamp:
Mar 7, 2024, 7:23:09 PM (4 months ago)
Author:
Bruno Cornec
Message:

remove differentiated support for cdrw

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.3/mondo/src/common/libmondo-devices.c

    r3872 r3874  
    5555extern char *call_program_and_get_last_line_of_output(const char *);
    5656
    57 static char g_cdrw_drive_is_here[MAX_STR_LEN / 4] = "";
     57static char g_cd_drive_is_here[MAX_STR_LEN / 4] = "";
    5858static char g_cdrom_drive_is_here[MAX_STR_LEN / 4] = "";
    5959static char g_dvd_drive_is_here[MAX_STR_LEN / 4] = "";
     
    105105        if (strlen(g_dvd_drive_is_here) > 0) {
    106106            inject_device(g_dvd_drive_is_here);
    107         }
    108         if (strlen(g_cdrw_drive_is_here) > 0) {
    109             inject_device(g_cdrw_drive_is_here);
    110107        }
    111108    }
     
    188185    case cdr:
    189186        strcpy(output, "cdr");
    190         break;
    191     case cdrw:
    192         strcpy(output, "cdrw");
    193187        break;
    194188    case cdstream:
     
    501495    }
    502496    return (res);
    503 }
    504 
    505 
    506 
    507 
    508 
    509 
    510 /**
    511  * Locate a CD-R/W writer's SCSI node.
    512  * @param cdrw_device SCSI node will be placed here.
    513  * @return 0 for success, nonzero for failure.
    514  */
    515 int find_cdrw_device(char *cdrw_device)
    516 {
    517     /*@ buffers ************************ */
    518     char *tmp = NULL;
    519     char *cdr_exe = NULL;
    520     char *command = NULL;
    521 
    522     if (g_cdrw_drive_is_here[0]) {
    523         strcpy(cdrw_device, g_cdrw_drive_is_here);
    524         log_msg(3, "Been there, done that. Returning %s", cdrw_device);
    525         return (0);
    526     }
    527     if (g_backup_media_type == dvd) {
    528         log_msg(1, "This is dumb. You're calling find_cdrw_device() but you're backing up to DVD. WTF?");
    529         return (1);
    530     }
    531     run_program_and_log_output("insmod ide-scsi", -1);
    532     if ((cdr_exe = find_home_of_exe("cdrecord")) == NULL) {
    533         if ((cdr_exe = find_home_of_exe("wodim")) == NULL) {
    534             cdr_exe = find_home_of_exe("dvdrecord");
    535         }
    536     }
    537     if (cdr_exe != NULL) {
    538         mr_asprintf(command, "%s -scanbus 2> /dev/null | tr -s '\t' ' ' | grep \"[0-9]*,[0-9]*,[0-9]*\" | grep -v \"[0-9]*) \\*\" | grep -E '[D|C][V|D]' | cut -d' ' -f2 | head -n1", cdr_exe);
    539         tmp = call_program_and_get_last_line_of_output(command);
    540         mr_free(command);
    541     }
    542     if ((tmp == NULL) || (strlen(tmp) < 2)) {
    543         mr_free(tmp);
    544         mr_free(cdr_exe);
    545         return (1);
    546     } else {
    547         strcpy(cdrw_device, tmp);
    548         log_it("Found CDRW device - %s", cdrw_device);
    549         strcpy(g_cdrw_drive_is_here, cdrw_device);
    550         mr_free(tmp);
    551         mr_free(cdr_exe);
    552         return (0);
    553     }
    554497}
    555498
     
    786729                                        (found_it =
    787730                                         set_dev_to_this_if_rx_OK(output,
    788                                                                   g_cdrw_drive_is_here)))
     731                                                                  g_cd_drive_is_here)))
    789732                                    {
    790733                                        retval = 1;
     
    837780    }
    838781
    839     mr_asprintf(command, "%s -scanbus | grep \"[0-9],[0-9],[0-9]\" | grep -E \"[D|C][V|D]\" | grep -n \"\" | grep \"%s\" | cut -d':' -f2", cdr_exe, g_cdrw_drive_is_here);
     782    mr_asprintf(command, "%s -scanbus | grep \"[0-9],[0-9],[0-9]\" | grep -E \"[D|C][V|D]\" | grep -n \"\" | grep \"%s\" | cut -d':' -f2", cdr_exe, g_cd_drive_is_here);
    840783
    841784    log_msg(1, "command=%s", command);
     
    22492192    switch (bkpinfo->backup_media_type) {
    22502193    case cdr:
    2251     case cdrw:
    22522194    case dvd:
    22532195    case usb:
     
    23382280            log_msg(2, "%s device found at %s", mds, bkpinfo->media_device);
    23392281        } else {
    2340             if ((find_cdrw_device(bkpinfo->media_device)) && (bkpinfo->backup_media_type != usb)) {
     2282            if ((find_cdrom_device(bkpinfo->media_device)) && (bkpinfo->backup_media_type != usb)) {
    23412283                mr_free(bkpinfo->media_device);
    23422284            }
Note: See TracChangeset for help on using the changeset viewer.