parse_em28xx_drxk.pl: Fix for read16/write16
authorMauro Carvalho Chehab <mchehab@redhat.com>
Sun, 10 Jul 2011 17:16:45 +0000 (14:16 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sun, 10 Jul 2011 17:16:45 +0000 (14:16 -0300)
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
contrib/em28xx/parse_em28xx_drxk.pl

index 3d0ec2e..8659cca 100755 (executable)
@@ -2171,16 +2171,18 @@ sub parse_drxk_addr($$$$$)
        } else {
                $reg = sprintf "0x%08x", $reg;
        }
-       my $data = hex(substr($app_data, $j, 2)) |
-                  hex(substr($app_data, $j + 3, 2)) << 16;
-
-       $data |= hex(substr($app_data, $j + 6, 2)) << 24 |
-                hex(substr($app_data, $j + 9, 2)) << 8 if ($n > 2);
 
+       my $data;
        if ($n == 2) {
                $bits = 16;
+               $data = hex(substr($app_data, $j, 2)) |
+                       hex(substr($app_data, $j + 3, 2)) << 8;
        } else {
                $bits = 32;
+               $data = hex(substr($app_data, $j, 2)) |
+                       hex(substr($app_data, $j + 3, 2)) << 16 |
+                       hex(substr($app_data, $j + 6, 2)) << 24 |
+                       hex(substr($app_data, $j + 9, 2)) << 8 if ($n > 2);
        }
 
        if ($flags) {