Thanks for the reply.

I don't think uhubctl supports my hub because it cannot detect the hub. And
I'm just having a hard time using pyusb. dev.detach_kernel_driver(0) and
dev.set_configuration() work fine. But after that, I don't know how to use
ctrl_transfer to control the port power. I tried some values on
https://wiki.osdev.org/Universal_Serial_Bus. And I tried combinations of

retType_list = [0x00, 0x01, 0x02, 0x03, 0x20, 0x21, 0x22, 0x23, 0x30, 0x31,
0x32, 0x33, 0x40, 0x41, 0x42, 0x43]
bReq_list = [0x01, 0x03]
wVal_list = [0x00, 0x01, 0x02]
wIndex_list = [0, 1, 2, 0x20, 0x81, 0xa0]

But the powers never went to 0000.0000.

Best,
Anthony

On Mon, Nov 30, 2020 at 5:39 PM Karl Palsson <ka...@tweak.net.au> wrote:

>
> Well. For starters, does it _actually_ support port power control
> (even ganged) or does it just say it does?
>
> Does it work using existing tools like uhubctrl [1] or similar,
> and you're just having a hard time porting to pyusb or has this
> never worked?
>
> Sincerely,
> Karl Palsson
>
> [1] https://github.com/mvp/uhubctl
>
>
> Anthony An <dstdas...@gmail.com> wrote:
> > I'm trying to control the power of a camera that is connected
> > to a ganged port power control hub. With dev =
> > usb.core.find(idVendor=0x1a40, idProduct=0x0401) and
> > bmRequestTypes = [0x00, 0x01, 0x02, 0x03, 0x20, 0x21, 0x22,
> > 0x23, 0x40, 0x41, 0x42, 0x43], I tried to use ctrl_transfer,
> > but none of them worked. Can someone help me to figure out how
> > to control the power? What I want is turning off the power, not
> > just disabling the port.
> >
> >
> >
> >
> > Bus 001 Device 004: ID 1a40:0401 Terminus Technology Inc.
> > Device Descriptor:
> >   bLength                18
> >   bDescriptorType         1
> >   bcdUSB               2.00
> >   bDeviceClass            9 Hub
> >   bDeviceSubClass         0 Unused
> >   bDeviceProtocol         1 Single TT
> >   bMaxPacketSize0        64
> >   idVendor           0x1a40 Terminus Technology Inc.
> >   idProduct          0x0401
> >   bcdDevice            1.00
> >   iManufacturer           0
> >   iProduct                1 USB 2.0 Hub
> >   iSerial                 0
> >   bNumConfigurations      1
> >   Configuration Descriptor:
> >     bLength                 9
> >     bDescriptorType         2
> >     wTotalLength           25
> >     bNumInterfaces          1
> >     bConfigurationValue     1
> >     iConfiguration          0
> >     bmAttributes         0xe0
> >       Self Powered
> >       Remote Wakeup
> >     MaxPower              100mA
> >     Interface Descriptor:
> >       bLength                 9
> >       bDescriptorType         4
> >       bInterfaceNumber        0
> >       bAlternateSetting       0
> >       bNumEndpoints           1
> >       bInterfaceClass         9 Hub
> >       bInterfaceSubClass      0 Unused
> >       bInterfaceProtocol      0 Full speed (or root) hub
> >       iInterface              0
> >       Endpoint Descriptor:
> >         bLength                 7
> >         bDescriptorType         5
> >         bEndpointAddress     0x81  EP 1 IN
> >         bmAttributes            3
> >           Transfer Type            Interrupt
> >           Synch Type               None
> >           Usage Type               Data
> >         wMaxPacketSize     0x0001  1x 1 bytes
> >         bInterval              12
> > Hub Descriptor:
> >   bLength               9
> >   bDescriptorType      41
> >   nNbrPorts             2
> >   wHubCharacteristic 0x0004
> >     Ganged power switching
> >     Compound device
> >     Ganged overcurrent protection
> >     TT think time 8 FS bits
> >   bPwrOn2PwrGood       50 * 2 milli seconds
> >   bHubContrCurrent    100 milli Ampere
> >   DeviceRemovable    0x06
> >   PortPwrCtrlMask    0xff
> >  Hub Port Status:
> >    Port 1: 0000.0100 power
> >    Port 2: 0000.0100 power
> > _______________________________________________
> > pyusb-users mailing list
> > pyusb-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/pyusb-users
> _______________________________________________
> pyusb-users mailing list
> pyusb-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/pyusb-users
>
_______________________________________________
pyusb-users mailing list
pyusb-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pyusb-users

Reply via email to