Re: Powercycling USB device on hub

2011-07-20 Thread Hans Petter Selasky
On Wednesday 20 July 2011 14:30:37 Peer Stritzinger wrote:
> Hi,
> 
> is ist possible to power-cycle the HUB port of a USB device by
> programmatic means (via script or libusb or some ioctl)?
> 
> It would be perfect if I could power-off/on just a certain device but
> it would also help to power-cycle all devices on a HUB.
> 

Hi,

Using the usbconfig utility in 8 stable and 9 current, you can set the 
configuration to 255 which means unconfigured and then 0 for the root HUB. For 
non-root HUBs you can BUS-reset the devices usbconfig -d X.Y reset or 
set_config aswell. There is also a power_off command, but your device might 
not come back after that.

--HPS
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Powercycling USB device on hub

2011-07-20 Thread Peer Stritzinger
Hi,

is ist possible to power-cycle the HUB port of a USB device by
programmatic means (via script or libusb or some ioctl)?

It would be perfect if I could power-off/on just a certain device but
it would also help to power-cycle all devices on a HUB.

Cheers,
Peer Stritzinger
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: Porting op to FreeBSD

2011-07-20 Thread Matt Dawson
On Tuesday 19 July 2011 14:13:17 Hans Petter Selasky wrote:

> > http://sourceforge.net/projects/openprogrammer/files/OP/op_0.7.9.
> > tar.gz
> > 
> > to FreeBSD and have run into a brick wall (my lack of knowledge,
> > basically). It uses Linux' hiddev to communicate with the
> > OpenProgrammer hardware, which isn't compatible with our usbhid.
> > The ioctls and structs are very different. The programmer itself
> > has a uhidX device node and seems to be fine under FreeBSD.
> 
> There are many ways to achieve your goal. The simplest one might be
> to compile the Linux HID layer into the webcamd deamon and have a
> compatible interface. This means no porting effort.

Interesting, although it does introduce a dependency on webcamd which, 
for an otherwise small program, seems a little mad.

> You will have to checkout and install the linux_make tool from the
> I4B SVN, referred to from the webcamd
> (/usr/ports/multimedia/webcamd) homepage:
> 
> http://www.selasky.org/hans_petter/video4bsd/
> 
> And add some config entries to the config file for the HID layer,
> and possibly also resolve a few compile issues.

I suspect this is going to be the main issue. It pulls in hiddev.h for 
Linux directly and has no configure stage, so it expects those headers 
to be where they should be on a vanilla Linux box. It does compile 
under Windows/Cygwin with a conditional in the defines, so the 
dependency on hiddev is obviously portable. I'd much rather make it 
native and throw my changes back upstream. The whole point of this 
device is that it's open so it needs to run everywhere and that little 
CLI really is the bare bones.

I have been in contact with the developer and he thinks getting read() 
and write() working is the main step and everything else is trivial. 
It's just translating those ioctl calls and structs to our usbhid that 
stumping me, simply because I don't understand what they do in either 
OS. I have an idea that the ioctls are simply to pull in the packet 
size for read and write operations but, beyond that, my clue chest is 
empty.

I'll probably have to just bite the bullet, sit down and compare what 
it does in both Linux and Windows/Cygwin and then try to work out how 
to get the same results on FreeBSD. There's no being lazy, it seems!
-- 
Matt Dawson
MTD15-RIPE
m...@chronos.org.uk
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"