Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

802 lines
18 KiB

  1. /*******************************************************************************
  2. *
  3. * (C) COPYRIGHT MICROSOFT CORP., 1993-1995
  4. * TITLE: ITEMFIND.CPP
  5. * VERSION: 1.0
  6. * AUTHOR: jsenior
  7. * DATE: 10/28/1998
  8. *
  9. ********************************************************************************
  10. *
  11. * CHANGE LOG:
  12. *
  13. * DATE REV DESCRIPTION
  14. * ---------- ------- ----------------------------------------------------------
  15. * 10/28/1998 jsenior Original implementation.
  16. *
  17. *******************************************************************************/
  18. #include "ItemFind.h"
  19. #include "debug.h"
  20. #include "resource.h"
  21. extern HINSTANCE gHInst;
  22. BOOL
  23. UsbItemActionFindIsoDevices::operator()(UsbItem *Item)
  24. {
  25. AddInterruptBW(Item);
  26. if (Item->ComputeBandwidth()) {
  27. isoDevices.push_back(Item);
  28. }
  29. return TRUE;
  30. }
  31. UINT
  32. UsbItemActionFindIsoDevices::InterruptBW()
  33. {
  34. UINT bw = 0;
  35. for (int i = 0; i < USB_NUM_FRAMES; i++) {
  36. if (interruptBW[i] > bw) {
  37. bw = interruptBW[i];
  38. }
  39. }
  40. return bw;
  41. }
  42. void
  43. UsbItemActionFindIsoDevices::AddInterruptBW(UsbItem *item)
  44. {
  45. UCHAR Interval, x;
  46. PUSB_ENDPOINT_DESCRIPTOR endpoint = 0;
  47. UINT endpointBW;
  48. PUSB_PIPE_INFO pipeInfo;
  49. if (item->deviceInfo && item->deviceInfo->connectionInfo) {
  50. //
  51. // Iterate through the open pipes
  52. //
  53. for (UINT i = 0; i < item->deviceInfo->connectionInfo->NumberOfOpenPipes; i++) {
  54. pipeInfo = &item->deviceInfo->connectionInfo->PipeList[i];
  55. endpoint = &pipeInfo->EndpointDescriptor;
  56. //
  57. // Only interested in interrupt endpoints
  58. //
  59. if (USB_ENDPOINT_TYPE_INTERRUPT ==
  60. (endpoint->bmAttributes & USB_ENDPOINT_TYPE_MASK)) {
  61. //
  62. // Find the appropriate interval - Max interval = 32
  63. //
  64. Interval = endpoint->bInterval;
  65. for (x = 0x20; x > 0x1; x = x >> 1) {
  66. if (Interval >= x) {
  67. break;
  68. }
  69. }
  70. Interval = x;
  71. //
  72. // Calculate the bandwidth per frame
  73. //
  74. endpointBW = UsbItem::EndpointBandwidth(
  75. endpoint->wMaxPacketSize,
  76. (UCHAR)(endpoint->bmAttributes & USB_ENDPOINT_TYPE_MASK),
  77. item->deviceInfo->connectionInfo->LowSpeed);
  78. //
  79. // Put the bandwidth in the appropriate frames
  80. //
  81. for (int j = pipeInfo->ScheduleOffset; j < USB_NUM_FRAMES; j += Interval) {
  82. interruptBW[j] += endpointBW;
  83. }
  84. }
  85. }
  86. }
  87. }
  88. BOOL
  89. UsbItemActionFindPower::operator()(UsbItem *Item)
  90. {
  91. if (Item->ComputePower()) {
  92. powerDevices.push_back(Item);
  93. } else {
  94. otherDevices.push_back(Item);
  95. }
  96. Item->ComputeBandwidth();
  97. return TRUE;
  98. }
  99. BOOL
  100. UsbItemActionFindSelfPoweredHubsWithFreePorts::operator()(UsbItem *Item)
  101. {
  102. if (IsValid(Item)) {
  103. hubs.push_back(Item);
  104. }
  105. return TRUE;
  106. }
  107. BOOL
  108. UsbItemActionFindSelfPoweredHubsWithFreePorts::IsValid(UsbItem *Item)
  109. {
  110. if (Item->PortPower() > 100 &&
  111. Item->NumPorts() > Item->NumChildren() &&
  112. Item->DistanceFromController() < DistanceFromControllerForDevice) {
  113. return TRUE;
  114. }
  115. return FALSE;
  116. }
  117. BOOL
  118. UsbItemActionFindSelfPoweredHubsWithFreePorts::IsExpanded(UsbItem *Item)
  119. {
  120. UsbItem *i;
  121. if (Item->IsHub() || Item->IsController()) {
  122. if (IsValid(Item)) {
  123. return TRUE;
  124. }
  125. for (i = Item->child; i; i = i->sibling) {
  126. if (IsExpanded(i) ||
  127. IsValid(i)) {
  128. return TRUE;
  129. }
  130. }
  131. }
  132. return FALSE;
  133. }
  134. BOOL
  135. UsbItemActionFindSelfPoweredHubsWithFreePortsForHub::operator()(UsbItem *Item)
  136. {
  137. if (IsValid(Item)) {
  138. hubs.push_back(Item);
  139. }
  140. return TRUE;
  141. }
  142. BOOL
  143. UsbItemActionFindSelfPoweredHubsWithFreePortsForHub::IsValid(UsbItem *Item)
  144. {
  145. if (Item->PortPower() > 100 &&
  146. Item->NumPorts() > Item->NumChildren() &&
  147. Item->DistanceFromController() < DistanceFromControllerForHub) {
  148. return TRUE;
  149. }
  150. return FALSE;
  151. }
  152. BOOL
  153. UsbItemActionFindSelfPoweredHubsWithFreePortsForHub::IsExpanded(UsbItem *Item)
  154. {
  155. UsbItem *i;
  156. if (Item->IsHub() || Item->IsController()) {
  157. if (IsValid(Item)) {
  158. return TRUE;
  159. }
  160. for (i = Item->child; i; i = i->sibling) {
  161. if (IsExpanded(i) ||
  162. IsValid(i)) {
  163. return TRUE;
  164. }
  165. }
  166. }
  167. return FALSE;
  168. }
  169. BOOL
  170. UsbItemActionFindHubsWithFreePorts::operator()(UsbItem *Item)
  171. {
  172. if (IsValid(Item)) {
  173. hubs.push_back(Item);
  174. }
  175. return TRUE;
  176. }
  177. BOOL
  178. UsbItemActionFindHubsWithFreePorts::IsValid(UsbItem *Item)
  179. {
  180. if (Item->NumPorts() > Item->NumChildren() &&
  181. Item->DistanceFromController() < DistanceFromControllerForHub) {
  182. return TRUE;
  183. }
  184. return FALSE;
  185. }
  186. BOOL
  187. UsbItemActionFindHubsWithFreePorts::IsExpanded(UsbItem *Item)
  188. {
  189. UsbItem *i;
  190. if (Item->IsHub() || Item->IsController()) {
  191. if (IsValid(Item)) {
  192. return TRUE;
  193. }
  194. for (i = Item->child; i; i = i->sibling) {
  195. if (IsExpanded(i) ||
  196. IsValid(i)) {
  197. return TRUE;
  198. }
  199. }
  200. }
  201. return FALSE;
  202. }
  203. BOOL
  204. UsbItemActionFindFreePortsOnSelfPoweredHubs::operator()(UsbItem *Item)
  205. {
  206. if (IsValid(Item)) {
  207. hubs.push_back(Item);
  208. }
  209. return TRUE;
  210. }
  211. BOOL
  212. UsbItemActionFindFreePortsOnSelfPoweredHubs::IsValid(UsbItem *Item)
  213. {
  214. if (Item->configInfo &&
  215. Item->IsUnusedPort() &&
  216. Item->parent &&
  217. Item->parent->PortPower() > 100) {
  218. return TRUE;
  219. }
  220. return FALSE;
  221. }
  222. BOOL
  223. UsbItemActionFindFreePortsOnSelfPoweredHubs::IsExpanded(UsbItem *Item)
  224. {
  225. UsbItem *i;
  226. if (Item->IsHub() || Item->IsController()) {
  227. for (i = Item->child; i; i = i->sibling) {
  228. if (IsExpanded(i) ||
  229. IsValid(i)) {
  230. return TRUE;
  231. }
  232. }
  233. }
  234. if (IsValid(Item)) {
  235. return TRUE;
  236. }
  237. return FALSE;
  238. }
  239. BOOL
  240. UsbItemActionFindLowPoweredDevicesOnSelfPoweredHubs::operator()(UsbItem *Item)
  241. {
  242. if (IsValid(Item)) {
  243. devices.push_back(Item);
  244. }
  245. return TRUE;
  246. }
  247. BOOL
  248. UsbItemActionFindLowPoweredDevicesOnSelfPoweredHubs::IsValid(UsbItem *Item)
  249. {
  250. if (Item->ComputePower()) {
  251. if (Item->power <= 100 &&
  252. !Item->IsHub() &&
  253. !(Item->cxnAttributes.PortAttributes & USB_PORTATTR_OEM_CONNECTOR) &&
  254. Item->parent &&
  255. Item->parent->IsHub() &&
  256. Item->parent->PortPower() > 100) {
  257. return TRUE;
  258. }
  259. }
  260. return FALSE;
  261. }
  262. BOOL
  263. UsbItemActionFindLowPoweredDevicesOnSelfPoweredHubs::IsExpanded(UsbItem *Item)
  264. {
  265. UsbItem *i;
  266. if (Item->IsHub() || Item->IsController()) {
  267. for (i = Item->child; i; i = i->sibling) {
  268. if (IsExpanded(i) ||
  269. IsValid(i)) {
  270. return TRUE;
  271. }
  272. }
  273. }
  274. return FALSE;
  275. }
  276. BOOL
  277. UsbItemActionFindDevicesOnHubs::operator()(UsbItem *Item)
  278. {
  279. if (IsValid(Item)) {
  280. devices.push_back(Item);
  281. }
  282. return TRUE;
  283. }
  284. BOOL
  285. UsbItemActionFindDevicesOnHubs::IsValid(UsbItem *Item)
  286. {
  287. if (!Item->IsHub() &&
  288. !(Item->cxnAttributes.PortAttributes & USB_PORTATTR_OEM_CONNECTOR) &&
  289. Item->parent &&
  290. Item->parent->IsHub() &&
  291. Item->parent->DistanceFromController() < DistanceFromControllerForHub) {
  292. return TRUE;
  293. }
  294. return FALSE;
  295. }
  296. BOOL
  297. UsbItemActionFindDevicesOnHubs::IsExpanded(UsbItem *Item)
  298. {
  299. UsbItem *i;
  300. if (Item->IsHub() || Item->IsController()) {
  301. for (i = Item->child; i; i = i->sibling) {
  302. if (IsExpanded(i) ||
  303. IsValid(i)) {
  304. return TRUE;
  305. }
  306. }
  307. }
  308. return FALSE;
  309. }
  310. BOOL
  311. UsbItemActionFindHighPoweredDevicesOnSelfPoweredHubs::operator()(UsbItem *Item)
  312. {
  313. if (IsValid(Item)) {
  314. devices.push_back(Item);
  315. }
  316. return TRUE;
  317. }
  318. BOOL
  319. UsbItemActionFindHighPoweredDevicesOnSelfPoweredHubs::IsValid(UsbItem *Item)
  320. {
  321. if (Item->ComputePower()) {
  322. if (Item->power > 100 &&
  323. !(Item->cxnAttributes.PortAttributes & USB_PORTATTR_OEM_CONNECTOR) &&
  324. Item->parent &&
  325. Item->parent->PortPower() > 100) {
  326. return TRUE;
  327. }
  328. }
  329. return FALSE;
  330. }
  331. BOOL
  332. UsbItemActionFindUnknownPoweredDevicesOnSelfPoweredHubs::operator()(UsbItem *Item)
  333. {
  334. if (IsValid(Item)) {
  335. devices.push_back(Item);
  336. }
  337. return TRUE;
  338. }
  339. BOOL
  340. UsbItemActionFindUnknownPoweredDevicesOnSelfPoweredHubs::IsValid(UsbItem *Item)
  341. {
  342. if (!Item->ComputePower()) {
  343. if (Item->parent &&
  344. Item->parent->PortPower() > 100) {
  345. return TRUE;
  346. }
  347. }
  348. return FALSE;
  349. }
  350. BOOL
  351. UsbItemActionFindUnknownPoweredDevicesOnSelfPoweredHubs::IsExpanded(UsbItem *Item)
  352. {
  353. UsbItem *i;
  354. if (Item->IsHub() || Item->IsController()) {
  355. for (i = Item->child; i; i = i->sibling) {
  356. if (IsExpanded(i) ||
  357. IsValid(i)) {
  358. return TRUE;
  359. }
  360. }
  361. }
  362. return FALSE;
  363. }
  364. BOOL
  365. UsbItemActionFindHighPoweredDevicesOnSelfPoweredHubs::IsExpanded(UsbItem *Item)
  366. {
  367. UsbItem *i;
  368. if (Item->IsHub() || Item->IsController()) {
  369. for (i = Item->child; i; i = i->sibling) {
  370. if (IsExpanded(i) ||
  371. IsValid(i)) {
  372. return TRUE;
  373. }
  374. }
  375. }
  376. return FALSE;
  377. }
  378. DEVINST UsbItemActionFindOvercurrentDevice::devInst = 0;
  379. BOOL
  380. UsbItemActionFindOvercurrentDevice::operator()(UsbItem *Item)
  381. {
  382. if (IsValid(Item)) {
  383. device = Item;
  384. }
  385. return TRUE;
  386. }
  387. BOOL
  388. UsbItemActionFindOvercurrentDevice::IsValid(UsbItem *Item)
  389. {
  390. if (Item->configInfo->devInst == devInst) {
  391. return TRUE;
  392. }
  393. return FALSE;
  394. }
  395. BOOL
  396. UsbItemActionFindOvercurrentDevice::IsExpanded(UsbItem *Item)
  397. {
  398. UsbItem *i;
  399. if (Item->IsHub() || Item->IsController()) {
  400. if (IsValid(Item)) {
  401. return TRUE;
  402. }
  403. for (i = Item->child; i; i = i->sibling) {
  404. if (IsExpanded(i) ||
  405. IsValid(i)) {
  406. return TRUE;
  407. }
  408. }
  409. }
  410. return FALSE;
  411. }
  412. String UsbItemActionFindOvercurrentHubPort::hubName = L"";
  413. ULONG UsbItemActionFindOvercurrentHubPort::portIndex = 0;
  414. BOOL
  415. UsbItemActionFindOvercurrentHubPort::operator()(UsbItem *Item)
  416. {
  417. if (IsValid(Item)) {
  418. device = Item;
  419. }
  420. return TRUE;
  421. }
  422. BOOL
  423. UsbItemActionFindOvercurrentHubPort::IsValid(UsbItem *Item)
  424. {
  425. if (Item->parent) {
  426. if (Item->parent->deviceInfo ) {
  427. if (Item->parent->deviceInfo->hubName == hubName &&
  428. Item->cxnAttributes.ConnectionIndex == portIndex) {
  429. if (Item->configInfo &&
  430. Item->IsUnusedPort())
  431. {
  432. //
  433. // Change the name to unknown device from unused port,
  434. // because there was probably something there originally.
  435. //
  436. TCHAR buf[MAX_PATH];
  437. LoadString(gHInst, IDS_UNKNOWNDEVICE, buf, MAX_PATH);
  438. Item->configInfo->deviceDesc = buf;
  439. }
  440. return TRUE;
  441. }
  442. }
  443. }
  444. return FALSE;
  445. }
  446. BOOL
  447. UsbItemActionFindOvercurrentHubPort::IsExpanded(UsbItem *Item)
  448. {
  449. UsbItem *i;
  450. if (Item->IsHub() || Item->IsController()) {
  451. if (IsValid(Item)) {
  452. return TRUE;
  453. }
  454. for (i = Item->child; i; i = i->sibling) {
  455. if (IsExpanded(i) ||
  456. IsValid(i)) {
  457. return TRUE;
  458. }
  459. }
  460. }
  461. return FALSE;
  462. }
  463. BOOL
  464. UsbItemActionFindUsb2xHubsWithFreePorts::operator()(UsbItem *Item)
  465. {
  466. if (IsValid(Item)) {
  467. hubs.push_back(Item);
  468. }
  469. return TRUE;
  470. }
  471. BOOL
  472. UsbItemActionFindUsb2xHubsWithFreePorts::IsValid(UsbItem *Item)
  473. {
  474. if (Item->NumPorts() > Item->NumChildren() && // This hub has room
  475. UsbItemActionFindUsb2xHubs::IsValid(Item)) { // This is a 2.0 hub plugged into a 2.0 bus
  476. return TRUE;
  477. }
  478. return FALSE;
  479. }
  480. BOOL
  481. UsbItemActionFindUsb2xHubsWithFreePorts::IsExpanded(UsbItem *Item)
  482. {
  483. UsbItem *i;
  484. if (Item->IsHub() || Item->IsController()) {
  485. if (IsValid(Item)) {
  486. return TRUE;
  487. }
  488. for (i = Item->child; i; i = i->sibling) {
  489. if (IsExpanded(i) ||
  490. IsValid(i)) {
  491. return TRUE;
  492. }
  493. }
  494. }
  495. return FALSE;
  496. }
  497. BOOL
  498. UsbItemActionFindFreePortsOnUsb2xHubs::operator()(UsbItem *Item)
  499. {
  500. if (IsValid(Item)) {
  501. hubs.push_back(Item);
  502. }
  503. return TRUE;
  504. }
  505. BOOL
  506. UsbItemActionFindFreePortsOnUsb2xHubs::IsValid(UsbItem *Item)
  507. {
  508. if (Item->configInfo &&
  509. Item->IsUnusedPort() &&
  510. Item->parent &&
  511. UsbItemActionFindUsb2xHubs::IsValid(Item->parent)) {
  512. return TRUE;
  513. }
  514. return FALSE;
  515. }
  516. BOOL
  517. UsbItemActionFindFreePortsOnUsb2xHubs::IsExpanded(UsbItem *Item)
  518. {
  519. UsbItem *i;
  520. if (Item->IsHub() || Item->IsController()) {
  521. for (i = Item->child; i; i = i->sibling) {
  522. if (IsExpanded(i) ||
  523. IsValid(i)) {
  524. return TRUE;
  525. }
  526. }
  527. }
  528. if (IsValid(Item)) {
  529. return TRUE;
  530. }
  531. return FALSE;
  532. }
  533. BOOL
  534. UsbItemActionFindUsb1xDevicesOnUsb2xHubs::operator()(UsbItem *Item)
  535. {
  536. if (IsValid(Item)) {
  537. devices.push_back(Item);
  538. }
  539. return TRUE;
  540. }
  541. BOOL
  542. UsbItemActionFindUsb1xDevicesOnUsb2xHubs::IsValid(UsbItem *Item)
  543. {
  544. if (Item->UsbVersion() < 0x200 &&
  545. Item->parent &&
  546. UsbItemActionFindUsb2xHubs::IsValid(Item->parent)) {
  547. return TRUE;
  548. }
  549. return FALSE;
  550. }
  551. BOOL
  552. UsbItemActionFindUsb1xDevicesOnUsb2xHubs::IsExpanded(UsbItem *Item)
  553. {
  554. UsbItem *i;
  555. if (Item->IsHub() || Item->IsController()) {
  556. for (i = Item->child; i; i = i->sibling) {
  557. if (IsExpanded(i) ||
  558. IsValid(i)) {
  559. return TRUE;
  560. }
  561. }
  562. }
  563. return FALSE;
  564. }
  565. BOOL
  566. UsbItemActionFindUnknownDevicesOnUsb2xHubs::operator()(UsbItem *Item)
  567. {
  568. if (IsValid(Item)) {
  569. devices.push_back(Item);
  570. }
  571. return TRUE;
  572. }
  573. BOOL
  574. UsbItemActionFindUnknownDevicesOnUsb2xHubs::IsValid(UsbItem *Item)
  575. {
  576. if (!Item->UsbVersion()) {
  577. if (Item->parent &&
  578. UsbItemActionFindUsb2xHubs::IsValid(Item->parent)) {
  579. return TRUE;
  580. }
  581. }
  582. return FALSE;
  583. }
  584. BOOL
  585. UsbItemActionFindUnknownDevicesOnUsb2xHubs::IsExpanded(UsbItem *Item)
  586. {
  587. UsbItem *i;
  588. if (Item->IsHub() || Item->IsController()) {
  589. for (i = Item->child; i; i = i->sibling) {
  590. if (IsExpanded(i) ||
  591. IsValid(i)) {
  592. return TRUE;
  593. }
  594. }
  595. }
  596. return FALSE;
  597. }
  598. BOOL
  599. UsbItemActionFindUsb2xDevicesOnUsb2xHubs::operator()(UsbItem *Item)
  600. {
  601. if (IsValid(Item)) {
  602. devices.push_back(Item);
  603. }
  604. return TRUE;
  605. }
  606. BOOL
  607. UsbItemActionFindUsb2xDevicesOnUsb2xHubs::IsValid(UsbItem *Item)
  608. {
  609. if (Item->UsbVersion() >= 0x200 &&
  610. Item->parent &&
  611. UsbItemActionFindUsb2xHubs::IsValid(Item->parent)) {
  612. return TRUE;
  613. }
  614. return FALSE;
  615. }
  616. BOOL
  617. UsbItemActionFindUsb2xDevicesOnUsb2xHubs::IsExpanded(UsbItem *Item)
  618. {
  619. UsbItem *i;
  620. if (Item->IsHub() || Item->IsController()) {
  621. for (i = Item->child; i; i = i->sibling) {
  622. if (IsExpanded(i) ||
  623. IsValid(i)) {
  624. return TRUE;
  625. }
  626. }
  627. }
  628. return FALSE;
  629. }
  630. BOOL
  631. UsbItemActionFindUsb2xHubs::operator()(UsbItem *Item)
  632. {
  633. if (IsValid(Item)) {
  634. hubs.push_back(Item);
  635. }
  636. return TRUE;
  637. }
  638. BOOL
  639. UsbItemActionFindUsb2xHubs::IsValid(UsbItem *Item)
  640. {
  641. if (Item->IsHub() && // This is a hub
  642. Item->UsbVersion() >= 0x200 && // This is a 2.0 device
  643. (Item->parent->IsController() || // 2.0 Root hub
  644. (Item->parent->IsHub() && IsValid(Item->parent)))) { // Parent is valid
  645. return TRUE;
  646. }
  647. return FALSE;
  648. }
  649. BOOL
  650. UsbItemActionFindUsb2xHubs::IsExpanded(UsbItem *Item)
  651. {
  652. UsbItem *i;
  653. if (Item->IsHub() || Item->IsController()) {
  654. for (i = Item->child; i; i = i->sibling) {
  655. if (IsExpanded(i) ||
  656. IsValid(i)) {
  657. return TRUE;
  658. }
  659. }
  660. }
  661. return FALSE;
  662. }
  663. BOOL
  664. UsbItemActionFindDevicesOnSelfPoweredHubs::operator()(UsbItem *Item)
  665. {
  666. if (IsValid(Item)) {
  667. devices.push_back(Item);
  668. }
  669. return TRUE;
  670. }
  671. BOOL
  672. UsbItemActionFindDevicesOnSelfPoweredHubs::IsValid(UsbItem *Item)
  673. {
  674. if (!Item->IsHub() &&
  675. Item->parent &&
  676. Item->parent->IsHub() &&
  677. Item->parent->PortPower() > 100 &&
  678. Item->parent->DistanceFromController() < DistanceFromControllerForHub) {
  679. return TRUE;
  680. }
  681. return FALSE;
  682. }
  683. BOOL
  684. UsbItemActionFindDevicesOnSelfPoweredHubs::IsExpanded(UsbItem *Item)
  685. {
  686. UsbItem *i;
  687. if (Item->IsHub() || Item->IsController()) {
  688. for (i = Item->child; i; i = i->sibling) {
  689. if (IsExpanded(i) ||
  690. IsValid(i)) {
  691. return TRUE;
  692. }
  693. }
  694. }
  695. return FALSE;
  696. }
  697. BOOL
  698. UsbItemActionFindBusPoweredHubsOnSelfPoweredHubs::operator()(UsbItem *Item)
  699. {
  700. if (IsValid(Item)) {
  701. devices.push_back(Item);
  702. }
  703. return TRUE;
  704. }
  705. BOOL
  706. UsbItemActionFindBusPoweredHubsOnSelfPoweredHubs::IsValid(UsbItem *Item)
  707. {
  708. if (Item->ComputePower()) {
  709. if (Item->power <= 100 &&
  710. Item->IsHub() &&
  711. Item->parent &&
  712. Item->parent->IsHub() &&
  713. Item->parent->PortPower() > 100) {
  714. return TRUE;
  715. }
  716. }
  717. return FALSE;
  718. }
  719. BOOL
  720. UsbItemActionFindBusPoweredHubsOnSelfPoweredHubs::IsExpanded(UsbItem *Item)
  721. {
  722. UsbItem *i;
  723. if (Item->IsHub() || Item->IsController()) {
  724. for (i = Item->child; i; i = i->sibling) {
  725. if (IsExpanded(i) ||
  726. IsValid(i)) {
  727. return TRUE;
  728. }
  729. }
  730. }
  731. return FALSE;
  732. }