Page MenuHomeFreeBSD

Expose USB port physical information in ACPI by sysctl.

Authored by takawata on Jul 6 2019, 3:07 PM.



This expose USB port physical information (_UPC, _PLD) by sysctl.
This adds per port sysctl node tree with 3 children: upc, pldraw, info
upc is integer value that expose _UPC.
pldraw is buffer that raw PLD value.
info is interpreted version of above two.
example output follows.

sysctl -x dev.uhub.0.port1 Handle \_SB_.PCI0.XHC_.RHUB.HS01

Connectable TypeA port                                                  
Width 0 mm Height 0 mm                                                  
PanelPosition: Right                                                    
VertPosition: Center                                                    
HorizPosition: Lower                                                    
Shape: HRect                                                            
Group Orientation Horizontal                                            
GroupToken 0                                                            
GroupPosition 1                                                         
 Eject OSPM

dev.uhub.0.port1.pldraw: Format:A Length:16 Dump:0x81000000000000005912800003000
dev.uhub.0.port1.upc: 0x80000000

Diff Detail

rS FreeBSD src repository
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

takawata created this revision.Jul 6 2019, 3:07 PM
hselasky accepted this revision.Jul 6 2019, 6:39 PM

Looks good. Some minor nits. Please fix before commit.

238 ↗(On Diff #59468)

Please indent this line properly.

243 ↗(On Diff #59468)

same here.

423 ↗(On Diff #59468)

spelling: Skipping

431 ↗(On Diff #59468)

{ -> should go to next line

This revision is now accepted and ready to land.Jul 6 2019, 6:39 PM

Please re-base this patch on top of the latest 13-current.

Thank you!


takawata updated this revision to Diff 59573.Jul 9 2019, 3:47 PM

Merge the head version.

This revision now requires review to proceed.Jul 9 2019, 3:47 PM
hselasky added inline comments.Jul 9 2019, 4:40 PM
453 ↗(On Diff #59573)

This function is not allowed to fail! Once uhub_attach() returns success, the wrapper attach needs to return success aswell, else we start leaking uhub_softc's because nobody is calling uhub_detach() !

Was patch updated?

takawata updated this revision to Diff 60321.Jul 31 2019, 2:44 PM

Run detach routine on fail.

hselasky added inline comments.Jul 31 2019, 2:53 PM
500 ↗(On Diff #60321)

style: return (ret);

522 ↗(On Diff #60321)

style: return (ret);

takawata updated this revision to Diff 60381.Aug 2 2019, 7:33 AM

fix style .

hselasky accepted this revision.Aug 2 2019, 7:43 AM
This revision is now accepted and ready to land.Aug 2 2019, 7:43 AM