Ticket #12051: 0001-Update-Huawei-in-usb_modeswitch.patch

File 0001-Update-Huawei-in-usb_modeswitch.patch, 7.3 KB (added by haiqu, 10 years ago)
  • build/jam/packages/Haiku

    From 74edf8f7c13054dd90c8045488680ebcfa097d7a Mon Sep 17 00:00:00 2001
    From: haiqu <judd@ob-wan.com>
    Date: Sat, 9 May 2015 17:45:18 +1000
    Subject: [PATCH] Update Huawei in usb_modeswitch
    
    ---
     build/jam/packages/Haiku                           |  2 +-
     build/jam/packages/HaikuBootstrap                  |  2 +-
     .../kernel/drivers/common/usb_modeswitch.cpp       | 80 ++++++++++++++--------
     3 files changed, 52 insertions(+), 32 deletions(-)
    
    diff --git a/build/jam/packages/Haiku b/build/jam/packages/Haiku
    index 704b5ce..055c730 100644
    a b AddNewDriversToPackage power : $(SYSTEM_ADD_ONS_DRIVERS_POWER) ;  
    6868#AddNewDriversToPackage display     : display_adapter@x86 ;
    6969
    7070# legacy drivers
    71 AddDriversToPackage                 : console dprintf null <driver>tty zero ;
     71AddDriversToPackage                 : console dprintf null <driver>tty usb_modeswitch zero ;
    7272AddDriversToPackage audio hmulti    : $(SYSTEM_ADD_ONS_DRIVERS_AUDIO) ;
    7373AddDriversToPackage audio old       : $(SYSTEM_ADD_ONS_DRIVERS_AUDIO_OLD) ;
    7474AddDriversToPackage midi            : $(SYSTEM_ADD_ONS_DRIVERS_MIDI) ;
  • build/jam/packages/HaikuBootstrap

    diff --git a/build/jam/packages/HaikuBootstrap b/build/jam/packages/HaikuBootstrap
    index 0d6f674..bb23583 100644
    a b AddNewDriversToPackage power : acpi_battery@x86 ;  
    6868
    6969# legacy drivers
    7070AddDriversToPackage                 : console dprintf null random <driver>tty
    71                                         zero ;
     71                                        usb_modeswitch zero ;
    7272AddDriversToPackage audio hmulti    : $(SYSTEM_ADD_ONS_DRIVERS_AUDIO) ;
    7373AddDriversToPackage audio old       : $(SYSTEM_ADD_ONS_DRIVERS_AUDIO_OLD) ;
    7474AddDriversToPackage midi            : $(SYSTEM_ADD_ONS_DRIVERS_MIDI) ;
  • src/add-ons/kernel/drivers/common/usb_modeswitch.cpp

    diff --git a/src/add-ons/kernel/drivers/common/usb_modeswitch.cpp b/src/add-ons/kernel/drivers/common/usb_modeswitch.cpp
    index f1e3c85..e82f968 100644
    a b  
    88
    99/*
    1010    Devices and messages reference: usb-modeswitch-data-20100826
     11    Huawei devices updated to usb-modeswitch-data-20150115
    1112*/
    1213
    1314#include <ByteOrder.h>
    unsigned char kDevicesMsg[][31] = {  
    6465    {   /* MSG_HUAWEI_3 */
    6566        0x55, 0x53, 0x42, 0x43, 0x12, 0x34, 0x56, 0x78,
    6667        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11,
    67         0x06, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
     68        0x06, 0x20, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01,
    6869        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
    6970    },
    7071    {   /* MSG_NOKIA_1 */
    unsigned char kDevicesMsg[][31] = {  
    122123#define NOKIA_VENDOR    0x0421
    123124#define NOVATEL_VENDOR  0x1410
    124125#define ZYDAS_VENDOR    0x0ace
    125 #define ZTE_VENDOR  0x19d2
     126#define ZTE_VENDOR      0x19d2
    126127#define OLIVETTI_VENDOR 0x0b3c
    127128#define OPTION_VENDOR   0x0af0
    128129#define ATHEROS_VENDOR  0x0cf3
    static const struct {  
    133134    msgType type, type2, type3;
    134135} kDevices[] = {
    135136    {{ 0, 0, 0, HUAWEI_VENDOR, 0x101e}, MSG_HUAWEI_1},
    136     {{ 0, 0, 0, HUAWEI_VENDOR, 0x1446}, MSG_HUAWEI_1},
    137     {{ 0, 0, 0, HUAWEI_VENDOR, 0x1449}, MSG_HUAWEI_1},
    138     {{ 0, 0, 0, HUAWEI_VENDOR, 0x14ad}, MSG_HUAWEI_1},
    139     {{ 0, 0, 0, HUAWEI_VENDOR, 0x14b5}, MSG_HUAWEI_1},
    140     {{ 0, 0, 0, HUAWEI_VENDOR, 0x14b7}, MSG_HUAWEI_1},
    141     {{ 0, 0, 0, HUAWEI_VENDOR, 0x14ba}, MSG_HUAWEI_1},
    142     {{ 0, 0, 0, HUAWEI_VENDOR, 0x14c1}, MSG_HUAWEI_1},
    143     {{ 0, 0, 0, HUAWEI_VENDOR, 0x14c3}, MSG_HUAWEI_1},
    144     {{ 0, 0, 0, HUAWEI_VENDOR, 0x14c4}, MSG_HUAWEI_1},
    145     {{ 0, 0, 0, HUAWEI_VENDOR, 0x14c5}, MSG_HUAWEI_1},
    146     {{ 0, 0, 0, HUAWEI_VENDOR, 0x14d1}, MSG_HUAWEI_1},
    147     {{ 0, 0, 0, HUAWEI_VENDOR, 0x14fe}, MSG_HUAWEI_1},
    148     {{ 0, 0, 0, HUAWEI_VENDOR, 0x1505}, MSG_HUAWEI_1},
    149     {{ 0, 0, 0, HUAWEI_VENDOR, 0x151a}, MSG_HUAWEI_1},
    150     {{ 0, 0, 0, HUAWEI_VENDOR, 0x1520}, MSG_HUAWEI_1},
    151     {{ 0, 0, 0, HUAWEI_VENDOR, 0x1521}, MSG_HUAWEI_1},
    152     {{ 0, 0, 0, HUAWEI_VENDOR, 0x1523}, MSG_HUAWEI_1},
    153     {{ 0, 0, 0, HUAWEI_VENDOR, 0x1526}, MSG_HUAWEI_1},
    154     {{ 0, 0, 0, HUAWEI_VENDOR, 0x1553}, MSG_HUAWEI_1},
    155     {{ 0, 0, 0, HUAWEI_VENDOR, 0x1557}, MSG_HUAWEI_1},
    156     {{ 0, 0, 0, HUAWEI_VENDOR, 0x155b}, MSG_HUAWEI_1},
    157     {{ 0, 0, 0, HUAWEI_VENDOR, 0x1c0b}, MSG_HUAWEI_1},
    158     {{ 0, 0, 0, HUAWEI_VENDOR, 0x1c24}, MSG_HUAWEI_1},
    159     {{ 0, 0, 0, HUAWEI_VENDOR, 0x1f11}, MSG_HUAWEI_1},
    160137    {{ 0, 0, 0, HUAWEI_VENDOR, 0x1030}, MSG_HUAWEI_2},
    161138    {{ 0, 0, 0, HUAWEI_VENDOR, 0x1031}, MSG_HUAWEI_2},
     139    {{ 0, 0, 0, HUAWEI_VENDOR, 0x1446}, MSG_HUAWEI_3},
     140    {{ 0, 0, 0, HUAWEI_VENDOR, 0x1449}, MSG_HUAWEI_3},
     141    {{ 0, 0, 0, HUAWEI_VENDOR, 0x14ad}, MSG_HUAWEI_3},
     142    {{ 0, 0, 0, HUAWEI_VENDOR, 0x14b5}, MSG_HUAWEI_3},
     143    {{ 0, 0, 0, HUAWEI_VENDOR, 0x14b7}, MSG_HUAWEI_3},
     144    {{ 0, 0, 0, HUAWEI_VENDOR, 0x14ba}, MSG_HUAWEI_3},
     145    {{ 0, 0, 0, HUAWEI_VENDOR, 0x14c1}, MSG_HUAWEI_3},
     146    {{ 0, 0, 0, HUAWEI_VENDOR, 0x14c3}, MSG_HUAWEI_3},
     147    {{ 0, 0, 0, HUAWEI_VENDOR, 0x14c4}, MSG_HUAWEI_3},
     148    {{ 0, 0, 0, HUAWEI_VENDOR, 0x14c5}, MSG_HUAWEI_3},
     149    {{ 0, 0, 0, HUAWEI_VENDOR, 0x14d1}, MSG_HUAWEI_3},
     150    {{ 0, 0, 0, HUAWEI_VENDOR, 0x14fe}, MSG_HUAWEI_3},
     151    {{ 0, 0, 0, HUAWEI_VENDOR, 0x1505}, MSG_HUAWEI_3},
     152    {{ 0, 0, 0, HUAWEI_VENDOR, 0x151a}, MSG_HUAWEI_3},
     153    {{ 0, 0, 0, HUAWEI_VENDOR, 0x1520}, MSG_HUAWEI_3},
     154    {{ 0, 0, 0, HUAWEI_VENDOR, 0x1521}, MSG_HUAWEI_3},
     155    {{ 0, 0, 0, HUAWEI_VENDOR, 0x1523}, MSG_HUAWEI_3},
     156    {{ 0, 0, 0, HUAWEI_VENDOR, 0x1526}, MSG_HUAWEI_3},
     157    {{ 0, 0, 0, HUAWEI_VENDOR, 0x1553}, MSG_HUAWEI_3},
     158    {{ 0, 0, 0, HUAWEI_VENDOR, 0x1557}, MSG_HUAWEI_3},
     159    {{ 0, 0, 0, HUAWEI_VENDOR, 0x155b}, MSG_HUAWEI_3},
     160    {{ 0, 0, 0, HUAWEI_VENDOR, 0x156a}, MSG_HUAWEI_3},
     161    {{ 0, 0, 0, HUAWEI_VENDOR, 0x1576}, MSG_HUAWEI_3},
     162    {{ 0, 0, 0, HUAWEI_VENDOR, 0x157d}, MSG_HUAWEI_3},
     163    {{ 0, 0, 0, HUAWEI_VENDOR, 0x1583}, MSG_HUAWEI_3},
     164    {{ 0, 0, 0, HUAWEI_VENDOR, 0x15ca}, MSG_HUAWEI_3},
     165    {{ 0, 0, 0, HUAWEI_VENDOR, 0x15e7}, MSG_HUAWEI_3},
     166    {{ 0, 0, 0, HUAWEI_VENDOR, 0x1c0b}, MSG_HUAWEI_3},
     167    {{ 0, 0, 0, HUAWEI_VENDOR, 0x1c1b}, MSG_HUAWEI_3},
     168    {{ 0, 0, 0, HUAWEI_VENDOR, 0x1c24}, MSG_HUAWEI_3},
     169    {{ 0, 0, 0, HUAWEI_VENDOR, 0x1da1}, MSG_HUAWEI_3},
    162170    {{ 0, 0, 0, HUAWEI_VENDOR, 0x1f01}, MSG_HUAWEI_3},
     171    {{ 0, 0, 0, HUAWEI_VENDOR, 0x1f02}, MSG_HUAWEI_3},
     172    {{ 0, 0, 0, HUAWEI_VENDOR, 0x1f03}, MSG_HUAWEI_3},
     173    {{ 0, 0, 0, HUAWEI_VENDOR, 0x1f11}, MSG_HUAWEI_3},
     174    {{ 0, 0, 0, HUAWEI_VENDOR, 0x1f15}, MSG_HUAWEI_3},
     175    {{ 0, 0, 0, HUAWEI_VENDOR, 0x1f16}, MSG_HUAWEI_3},
     176    {{ 0, 0, 0, HUAWEI_VENDOR, 0x1f17}, MSG_HUAWEI_3},
     177    {{ 0, 0, 0, HUAWEI_VENDOR, 0x1f18}, MSG_HUAWEI_3},
     178    {{ 0, 0, 0, HUAWEI_VENDOR, 0x1f19}, MSG_HUAWEI_3},
     179    {{ 0, 0, 0, HUAWEI_VENDOR, 0x1f1b}, MSG_HUAWEI_3},
     180    {{ 0, 0, 0, HUAWEI_VENDOR, 0x1f1c}, MSG_HUAWEI_3},
     181    {{ 0, 0, 0, HUAWEI_VENDOR, 0x1f1d}, MSG_HUAWEI_3},
     182    {{ 0, 0, 0, HUAWEI_VENDOR, 0x1f1e}, MSG_HUAWEI_3},
    163183    {{ 0, 0, 0, NOKIA_VENDOR, 0x060c}, MSG_NOKIA_1},
    164184    {{ 0, 0, 0, NOKIA_VENDOR, 0x0610}, MSG_NOKIA_1},
    165185    {{ 0, 0, 0, NOKIA_VENDOR, 0x061d}, MSG_NOKIA_1},
    my_get_msg_type(const usb_device_descriptor *desc, int index)  
    388408            case 2:
    389409                return kDevices[i].type3;
    390410        }
    391            
     411
    392412    }
    393413
    394414    return MSG_NONE;
    my_modeswitch(my_device* device)  
    412432            TRACE_ALWAYS("send message %d failed\n", i + 1);
    413433            return err;
    414434        }
    415    
     435
    416436        TRACE("device switched: %p\n", device);
    417437
    418438        char data[36];
    my_modeswitch(my_device* device)  
    422442                i + 1, device->status);
    423443            return err;
    424444        }
    425         TRACE("device switched (response length %ld)\n", device->actual_length);   
     445        TRACE("device switched (response length %ld)\n", device->actual_length);
    426446    }
    427    
     447
    428448    TRACE("device switched: %p\n", device);
    429449
    430450    return B_OK;