Changeset 3844 in MondoRescue


Ignore:
Timestamp:
Mar 6, 2024, 2:09:16 AM (4 months ago)
Author:
Bruno Cornec
Message:

Fix find_dvd_device by removing useless second param and using wodim -inq

Location:
branches/3.3/mondo/src
Files:
5 edited

Legend:

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

    r3843 r3844  
    354354        }
    355355        if (!flag_set['d']) {
    356             if (!find_dvd_device(flag_val['d'])) {
     356            if (!find_dvd_device(flag_val['d'], FALSE)) {
    357357                flag_set['d'] = TRUE;
    358358                log_to_screen("I guess DVD drive is at %s", flag_val['d']);
  • branches/3.3/mondo/src/common/libmondo-devices-EXT.h

    r3843 r3844  
    1010                                    char *mountpoint);
    1111extern int find_cdrom_device(char *output, bool try_to_mount);
    12 extern int find_dvd_device(char *output);
     12extern int find_dvd_device(char *output, bool try_to_mount);
    1313extern long get_phys_size_of_drive(char *drive);
    1414extern bool is_this_a_valid_disk_format(char *format);
  • branches/3.3/mondo/src/common/libmondo-devices.c

    r3843 r3844  
    479479        strcpy(dev, g_dvd_drive_is_here);
    480480        if (!dev[0]) {
    481             find_dvd_device(dev);
     481            find_dvd_device(dev, FALSE);
    482482        }
    483483    } else {
    484484        strcpy(dev, g_cdrom_drive_is_here);
    485485        if (!dev[0]) {
    486             find_cdrom_device(dev);
     486            find_cdrom_device(dev, FALSE);
    487487        }
    488488    }
     
    870870
    871871
    872 int find_dvd_device(char *output)
     872int find_dvd_device(char *output, bool try_to_mount)
    873873{
    874874    char *tmp = NULL;
    875     char *tmp1 = NULL;
    876875    int retval = 0, devno = -1;
    877876
     
    882881    }
    883882
    884     mr_asprintf(tmp1, "cdrecord -inq dev=%s 2> /dev/null | grep -E 'Device seems to be'  | cut -d':' -f2", output);
    885     tmp = call_program_and_get_last_line_of_output(tmp1);
    886     mr_free(tmp1);
    887     log_msg(5, "cdrecord tmp = '%s'", tmp);
     883    tmp = call_program_and_get_last_line_of_output("dvdrecord -scanbus 2> /dev/null | grep -E '\)\ \'' | grep -n '' | grep -E '[D|C][V|D]' | cut -d':' -f1");
     884    log_msg(5, "tmp = '%s'", tmp);
     885    if (!tmp[0]) {
     886        mr_free(tmp);
     887        tmp = call_program_and_get_last_line_of_output("cdrecord -scanbus 2> /dev/null | grep -E '\)\ \'' | grep -n '' | grep -E '[D|C][V|D]' | cut -d':' -f1");
     888    }
     889    if (tmp[0]) {
     890        devno = atoi(tmp) - 1;
     891    }
    888892    mr_free(tmp);
    889893
    890     if (tmp != NULL) {
     894    if (devno >= 0) {
     895        retval = 0;
     896        sprintf(output, "/dev/scd%d", devno);
    891897        strcpy(g_dvd_drive_is_here, output);
    892898        log_msg(2, "I think DVD is at %s", output);
     
    895901        retval = 1;
    896902    }
    897     return(retval);
     903
     904    return (retval);
    898905}
    899906
     
    22522259            mr_asprintf(comment, "What speed is your %s (re)writer?", mds);
    22532260            if (bkpinfo->backup_media_type == dvd) {
    2254                 find_dvd_device(bkpinfo->media_device);
     2261                find_dvd_device(bkpinfo->media_device, FALSE);
    22552262                strcpy(tmp1, "1");
    22562263                mr_asprintf(sz_size, "%d", DEFAULT_DVD_DISK_SIZE);  // 4.7 salesman's GB = 4.482 real GB = 4482 MB
  • branches/3.3/mondo/src/common/libmondo-devices.h

    r3843 r3844  
    99int find_and_mount_actual_cd(char *mountpoint);
    1010int find_cdrom_device(char *output, bool try_to_mount);
    11 int find_dvd_device(char *output);
     11int find_dvd_device(char *output, bool try_to_mount);
    1212long get_phys_size_of_drive(char *drive);
    1313bool is_this_a_valid_disk_format(char *format);
  • branches/3.3/mondo/src/mondoarchive/mondoarchive.c

    r3843 r3844  
    301301        setup_newt_stuff();
    302302        malloc_string(tmp);
    303         if (find_dvd_device(tmp)) {
     303        if (find_dvd_device(tmp, atoi(argv[2]))) {
    304304            printf("Failed to find DVD drive\n");
    305305        } else {
Note: See TracChangeset for help on using the changeset viewer.