Comment 3 for bug 1800794

Revision history for this message
RussianNeuroMancer (russianneuromancer) wrote :

> Please include all the debugging information you can here

check_mbim_available function was modified like this:

check_mbim_available (void)
{
   int kver_fd = -1;
   ssize_t read_count;
   char kversion[100];
   char *cdc_mbim_module_path;
   struct stat buf;

   kver_fd = open(OSRELEASE_FILE, O_RDONLY);
   if (kver_fd > -1) {
      read_count = read(kver_fd, &kversion, 100);
      if (read_count > 0) {
         asprintf(&cdc_mbim_module_path, "%s/%s/%s",
                  MODULES_PATH,
                  kversion,
                  CDC_MBIM_DRIVER_PATH);
+ modeswitch_log("\n -> Let's check cdc_mbim_module_path : %s\n", cdc_mbim_module_path);
         if (!stat(cdc_mbim_module_path, &buf))
            goto success;
         if (!stat(CDC_MBIM_SYS_PATH, &buf))
            goto success;
      }
   }

   free(cdc_mbim_module_path);
   return 0;
success:
   free(cdc_mbim_module_path);
   return 1;
}

In result log which was on expired pastebin it was visible that patch that was printed after "Let's check cdc_mbim_module_path" message include line break. It was right after kernel version, that filled by #define OSRELEASE_FILE "/proc/sys/kernel/osrelease"

Example:
~$ cat /proc/sys/kernel/osrelease
4.19.0-041900-generic
~$ cat /proc/sys/kernel/osrelease | hexdump
0000000 2e34 3931 302e 302d 3134 3039 2d30 6567
0000010 656e 6972 0a63
0000016

Problem is that string in /proc/sys/kernel/osrelease include line break symbol, and nothing in dispatcher-c-rewrite.patch drop this new line symbol, so when check_mbim_available trying to check if cdc_mbim kernel module is present, it looking for "4.19.0-041900-generic\n" (\n is not visible but it's part of the string) instead of "4.19.0-041900-generic" folder.