VirtualBox

vbox的更動 36477 路徑 trunk/src


忽略:
時間撮記:
2011-3-30 下午05:21:29 (14 年 以前)
作者:
vboxsync
訊息:

USB: Also find extra vendor/class descriptor data.

檔案:
修改 1 筆資料

圖例:

未更動
新增
刪除
  • trunk/src/VBox/Devices/USB/USBProxyDevice.cpp

    r36475 r36477  
    269269}
    270270
     271/* Given the pointer to an interface or endpoint descriptor, find any following
     272 * non-standard (vendor or class) descriptors.
     273 */
     274static const void *collect_stray_bits(uint8_t *this_desc, uint8_t *end, uint16_t *cbExtra)
     275{
     276    uint8_t *tmp, *buf;
     277    uint8_t type;
     278
     279    Assert(*(this_desc + 1) == VUSB_DT_INTERFACE || *(this_desc + 1) == VUSB_DT_ENDPOINT);
     280    buf = this_desc;
     281
     282    /* Skip the current interface/endpoint descriptor. */
     283    buf += *(uint8_t *)buf;
     284
     285    /* Loop until we find another descriptor we understand. */
     286    for (tmp = buf; ((tmp + 1) < end) && *tmp; tmp += *tmp)
     287    {
     288        type = *(tmp + 1);
     289        if (type == VUSB_DT_INTERFACE || type == VUSB_DT_ENDPOINT)
     290            break;
     291    }
     292    *cbExtra = tmp - buf;
     293    if (*cbExtra)
     294        return buf;
     295    else
     296        return NULL;
     297}
     298
    271299/* Setup a vusb_interface structure given some preallocated structures
    272300 * to use, (we counted them already)
     
    279307    uint32_t altmap[4] = {0,};
    280308    uint8_t *tmp, *end = buf + len;
     309    uint8_t *orig_desc = buf;
    281310    uint8_t alt;
    282311    int state;
     
    328357                cur_if->pvMore = NULL;
    329358
     359            cur_if->pvClass = collect_stray_bits(tmp, end, &cur_if->cbClass);
     360
    330361            pIf->cSettings++;
    331362
     
    356387            else
    357388                cur_ep->pvMore = NULL;
     389
     390            cur_ep->pvClass = collect_stray_bits(tmp, end, &cur_ep->cbClass);
    358391
    359392            cur_ep->Core.wMaxPacketSize = RT_LE2H_U16(cur_ep->Core.wMaxPacketSize);
     
    437470        for(x=0; x < 32; x++)
    438471            if ( cnt.idmap[i] & (1 << x) )
    439                 if ( !copy_interface(pIf++, (i << 6) | x, &ifd, &epd, (uint8_t *)descs, tot_len) ) {
     472                if ( !copy_interface(pIf++, (i << 6) | x, &ifd, &epd, (uint8_t *)out->pvOriginal, tot_len) ) {
    440473                    Log(("copy_interface(%d,,) failed\n", pIf - 1));
    441474                    goto err;
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette