Changeset 3853 in MondoRescue for branches/3.3


Ignore:
Timestamp:
Mar 6, 2024, 3:41:10 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

    r3844 r3853  
    4545extern pid_t g_main_pid;
    4646extern char *resolve_softlinks_to_get_to_actual_device_file(char *);
    47 extern char *mr_popup_and_get_string(char *, char *, char *);
     47extern char *mr_popup_and_get_string(const char *, const char *, const char *);
    4848extern char *call_program_and_get_last_line_of_output(const char *);
    4949
     
    354354        }
    355355        if (!flag_set['d']) {
    356             if (!find_dvd_device(flag_val['d'], FALSE)) {
     356            if (!find_dvd_device(flag_val['d'])) {
    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

    r3844 r3853  
    1010                                    char *mountpoint);
    1111extern int find_cdrom_device(char *output, bool try_to_mount);
    12 extern int find_dvd_device(char *output, bool try_to_mount);
     12extern int find_dvd_device(char *output);
    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

    r3844 r3853  
    5353extern void setup_tmpdir(char *path);
    5454extern void setup_scratchdir(char *path);
    55 extern char *mr_popup_and_get_string(char *title, char *b, char *input);
     55extern char *mr_popup_and_get_string(const char *title, const char *b, const char *input);
    5656extern char *call_program_and_get_last_line_of_output(const char *);
    5757
     
    479479        strcpy(dev, g_dvd_drive_is_here);
    480480        if (!dev[0]) {
    481             find_dvd_device(dev, FALSE);
     481            find_dvd_device(dev);
    482482        }
    483483    } else {
    484484        strcpy(dev, g_cdrom_drive_is_here);
    485485        if (!dev[0]) {
    486             find_cdrom_device(dev, FALSE);
     486            find_cdrom_device(dev);
    487487        }
    488488    }
     
    870870
    871871
    872 int find_dvd_device(char *output, bool try_to_mount)
     872int find_dvd_device(char *output)
    873873{
    874874    char *tmp = NULL;
     875    char *tmp1 = NULL;
    875876    int retval = 0, devno = -1;
    876877
     
    881882    }
    882883
    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     }
     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);
    892888    mr_free(tmp);
    893889
    894     if (devno >= 0) {
    895         retval = 0;
    896         sprintf(output, "/dev/scd%d", devno);
     890    if (tmp != NULL) {
    897891        strcpy(g_dvd_drive_is_here, output);
    898892        log_msg(2, "I think DVD is at %s", output);
     
    901895        retval = 1;
    902896    }
    903 
    904     return (retval);
     897    return(retval);
    905898}
    906899
     
    22592252            mr_asprintf(comment, "What speed is your %s (re)writer?", mds);
    22602253            if (bkpinfo->backup_media_type == dvd) {
    2261                 find_dvd_device(bkpinfo->media_device, FALSE);
     2254                find_dvd_device(bkpinfo->media_device);
    22622255                strcpy(tmp1, "1");
    22632256                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

    r3844 r3853  
    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, bool try_to_mount);
     11int find_dvd_device(char *output);
    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

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