VirtualBox

Ignore:
Timestamp:
Jul 18, 2011 1:06:11 PM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
72953
Message:

USB/Solaris: vboxuser group access constraint for USB devices.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/solaris/USBProxyServiceSolaris.cpp

    r37599 r38016  
    161161}
    162162
    163 #if 0
    164 static int solarisWalkMinor(di_node_t Node, di_minor_t Minor, void *pvArg)
    165 {
    166     char *pszDevFsPath = di_devfs_path(Node);
    167     char *pszMinorName = di_minor_name(Minor);
    168     PUSBDEVICE pDev = (PUSBDEVICE)pvArg;
    169 
    170     AssertRelease(pDev);
    171 
    172     if (!pszDevFsPath || !pszMinorName)
    173         return DI_WALK_CONTINUE;
    174 
    175     RTStrAPrintf(&pDev->pszApId, "/devices%s:%s", pszDevFsPath, pszMinorName);
    176     di_devfs_path_free(pszDevFsPath);
    177 
    178     syslog(LOG_ERR, "VBoxUsbApId:%s\n", pDev->pszApId);
    179     return DI_WALK_TERMINATE;
    180 }
    181 
    182 static bool solarisGetApId(PUSBDEVICE pDev, char *pszDevicePath, di_node_t RootNode)
    183 {
    184     pDev->pszApId = NULL;
    185 
    186     /* Skip "/devices" prefix if any */
    187     char achDevicesDir[] = "/devices/";
    188     if (strncmp(pszDevicePath, achDevicesDir, sizeof(achDevicesDir)) == 0)
    189         pszDevicePath += sizeof(achDevicesDir);
    190 
    191     char *pszPhysical = RTStrDup(pszDevicePath);
    192     char *pszTmp = NULL;
    193 
    194     /* Remove dynamic component "::" if any */
    195     if ((pszTmp = strstr(pszPhysical, "::")) != NULL)
    196         *pszTmp = '\0';
    197 
    198     /* Remove minor name if any */
    199     if ((pszTmp = strrchr(pszPhysical, ':')) != NULL)
    200         *pszTmp = '\0';
    201 
    202     /* Walk device tree */
    203 //    di_node_t RootNode = di_init("/", DINFOCPYALL);
    204 //    if (RootNode != DI_NODE_NIL)
    205 //    {
    206 //        di_node_t MinorNode = di_lookup_node(RootNode, pszPhysical);
    207 //        if (MinorNode != DI_NODE_NIL)
    208         {
    209             di_walk_minor(RootNode, NULL, DI_CHECK_ALIAS | DI_CHECK_INTERNAL_PATH, pDev, solarisWalkMinor);
    210             return true;
    211         }
    212 //        di_fini(RootNode);
    213 //    }
    214 
    215     return false;
    216 }
    217 #endif
    218163
    219164static int solarisWalkDeviceNode(di_node_t Node, void *pvArg)
     
    316261                pCur->bPort = 0;
    317262
    318 #if 0
    319             /*
    320              * Obtain the dev_t of the device.
    321              */
    322             di_minor_t Minor = di_minor_next(Node, DI_MINOR_NIL);
    323             AssertBreak(Minor != DI_MINOR_NIL);
    324             dev_t DeviceNum = di_minor_devt(Minor);
    325 
    326             int DevInstance = 0;
    327             rc = solarisUSBGetInstance(pszDevicePath, &DevInstance);
    328 
    329             char szAddress[PATH_MAX + 128];
    330             RTStrPrintf(szAddress, sizeof(szAddress), "/dev/usb/%x.%x|%s", pCur->idVendor, pCur->idProduct, pszDevicePath);
    331             /* @todo after binding ugen we need to append the instance number to the address. Not yet sure how we can update PUSBDEVICE at that time. */
    332 
    333             pCur->pszAddress = RTStrDup(szAddress);
    334             AssertBreak(pCur->pszAddress);
    335 #endif
    336 
    337263            char pathBuf[PATH_MAX];
    338264            RTStrPrintf(pathBuf, sizeof(pathBuf), "%s", pszDevicePath);
     
    368294            pCur->enmState = solarisDetermineUSBDeviceState(pCur, Node);
    369295
    370 //            fValidDevice = solarisGetApId(pCur, pszDevicePath, Node);
    371             fValidDevice = true;
    372 
    373296            /*
    374297             * Valid device, add it to the list.
    375298             */
    376             if (fValidDevice)
    377             {
    378                 pCur->pPrev = pList->pTail;
    379                 if (pList->pTail)
    380                     pList->pTail = pList->pTail->pNext = pCur;
    381                 else
    382                     pList->pTail = pList->pHead = pCur;
    383             }
     299            fValidDevice = true;
     300            pCur->pPrev = pList->pTail;
     301            if (pList->pTail)
     302                pList->pTail = pList->pTail->pNext = pCur;
     303            else
     304                pList->pTail = pList->pHead = pCur;
     305
    384306            rc = DI_WALK_CONTINUE;
    385307        } while(0);
Note: See TracChangeset for help on using the changeset viewer.

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