Sisyphus repositório
Última atualização: 1 outubro 2023 | SRPMs: 18631 | Visitas: 37775177
en ru br
ALT Linux repositórios
S:3.23.8-alt1
5.0: 2.8.10-alt3
4.1: 2.8.10-alt2.M41.1
4.0: 2.7.12-alt2.M40.1
+backports:2.8.10-alt2.M40.1
3.0:
+backports:1.6.6a-alt0.M30.4.1

Group :: Edição
RPM: hplip

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs e FR  Repocop 

Patch: hplip-model-mismatch.patch
Download


diff --git a/io/hpmud/jd.c b/io/hpmud/jd.c
index 20df27a..7ed4918 100644
--- a/io/hpmud/jd.c
+++ b/io/hpmud/jd.c
@@ -208,7 +208,22 @@ enum HPMUD_RESULT __attribute__ ((visibility ("hidden"))) jd_open(mud_device *pd
    {
        /* Make sure uri model matches device id model. */
        hpmud_get_uri_model(pd->uri, uri_model, sizeof(uri_model));
+
+       /* remove possible hp_ string */
+       if (strncasecmp(uri_model, "HP_", 3) == 0)
+       {
+         memmove(uri_model, uri_model + 3, 127);
+         uri_model[127] = '\0';
+       }
+
        hpmud_get_model(pd->id, model, sizeof(model));
+       /* remove possible hp_ string */
+       if (strncasecmp(model, "HP_", 3) == 0)
+       {
+         memmove(model, model + 3, 127);
+         model[127] = '\0';
+       }
+
        if (strcasecmp(uri_model, model) != 0)
        {
           stat = HPMUD_R_INVALID_URI;  /* different device plugged in */
diff --git a/io/hpmud/model.c b/io/hpmud/model.c
index d546ec1..adb3d87 100644
--- a/io/hpmud/model.c
+++ b/io/hpmud/model.c
@@ -407,7 +407,10 @@ static int ParseFile(char *datFile, char *model, char *attr, int attrSize, int *
    char rcbuf[255];
    char section[128];
    char file[128];
-   int found=0, n;
+   int found=0;
+   size_t n;
+
+   size_t model_len = strlen(model);
 
    if ((fp = fopen(datFile, "r")) == NULL)
       goto bugout;
@@ -422,10 +425,17 @@ static int ParseFile(char *datFile, char *model, char *attr, int attrSize, int *
          strncpy(section, rcbuf+1, sizeof(section)); /* found new section */
          n = strlen(section);
          section[n-2]=0; /* remove ']' and CR */
+         n -= 2;
          if (strcasecmp(model, section) == 0 ||
-            (section[0] == 'h' && section[1] == 'p' &&
-             section[2] == '_' &&
-             strcasecmp(model, section + 3) == 0))
+             (section[0] == 'h' &&
+              section[1] == 'p' &&
+              section[2] == '_' &&
+              strcasecmp(model, section + 3) == 0) ||
+             (n > model_len &&
+              strncasecmp(section, model, model_len) == 0 &&
+              strncasecmp(section + model_len, "_series", strlen("_series")) == 0
+             )
+            )
          {
             /* Found model match. */
             *bytes_read = ResolveAttributes(fp, attr, attrSize); 
 
projeto & código: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
mantenedor atual: Michael Shigorin
mantenedor da tradução: Fernando Martini aka fmartini © 2009