[pvrusb2] Ability to fully reset a PVRUSB2 Device

Diego Rivera diego.rivera.cr at gmail.com
Sat Mar 16 11:54:16 CDT 2019


In response to my own question, after looking at the source code:
static void pvr_setup_attach(struct pvr2_context *pvr){    /* Create association with v4l layer
*/    pvr2_v4l2_create(pvr);#ifdef CONFIG_VIDEO_PVRUSB2_DVB    /* Create association with dvb layer
*/    pvr2_dvb_create(pvr);#endif#ifdef
CONFIG_VIDEO_PVRUSB2_SYSFS    pvr2_sysfs_create(pvr,class_ptr);#endif /* CONFIG_VIDEO_PVRUSB2_SYSFS
*/}
Which means one can't turn off the digital side of pvrusb2 without a recompile... ☹  I may actually
go that route, but that's a different problem which I'll tackle when I run up against it.
Cheers!

On Sat, 2019-03-16 at 10:46 -0600, Diego Rivera wrote:
> Negative on that count either... I unplugged the device and a few minutes later it's still spewing
> out that message.
> Side question: is there any way to disable the digital side of the driver upon launch? Maybe a
> parameter that can be passed in?
> Thanks for responding, too!! I realize this is a stale device but I certainly appreciate your
> time!-- 
> 
> 
> 
> Diego Rivera
> 
> On Sat, 2019-03-16 at 11:36 -0500, isely at isely.net wrote:
> > OK, now unplug it if you haven't already done so.  That should break the connection between the
> > driver and the hardware and cause the pvrusb2 driver to eventually stop crabbing and let
> > go.  That's a scenario that I executed A LOT when debugging the driver...
> > (If that doesn't work then there may be another problem.)
> >   -Mike
> > 
> > On Sat, 16 Mar 2019, Diego Rivera wrote:
> > "On the digital side"... you're right! Turns out TVHeadend was grabbing the digital side of
> > thetuners - I'll have to figure out a way to disable that, since I don't need that.  That said,
> > once Iturned off TVHeadend, modprobe -r no longer complained about the module being in
> > use.However, it just hung .... and the log is littered with "pvrusb2: Attempted to execute
> > controltransfer when device not ok"So definitely something's wrong here because either the
> > module is definitely caring what happens tothe device(s), or something in the overarching kernel
> > framework changed that appears to need updateson the module in order to properly comply... maybe
> > USB events were removed/modified that the driverexpects for correct functioning?Just shooting
> > blanks here... if there's additional debug information that I can provide, I'll bemore than
> > happy to try to rustle that up for you!Cheers!
> > On Sat, 2019-03-16 at 11:26 -0500, isely at isely.net wrote:
> > Interesting.The kernel of course will refuse to a remove a module until all references to it go
> > away.The USB side of the pvrus2 driver won't (shouldn't) care so physically unplugged the USB
> > cable(and doing all manner of USB reset attempts) isn't going to help (or hurt - the driver
> > won'tcare).The problem is not that the driver is referencing the USB port but rather that other
> > entities arereferencing the driver.  So the first obvious case is to ensure nobody has it open
> > which youdid.  Another thing to look at is to see what if other kernel modules are referencing
> > thedriver.  This might be happening on the digital side.  If you run lsmod to get a list of
> > kernelmodules installed you should also see reference counts and a list of what other kernel
> > modules arecausing that count to be non-zero.  If there are other modules listed, then they need
> > to beremoved first - lowering the reference count - before you can remove the pvrusb2
> > driver.Yes, it's been a long time since I've messed with this driver, sadly, but my recollection
> > is thatbasically while the pvrusb2 module will reference a lot of other modules to get its job
> > done, Ididn't think there was any kernel modules that could reference the pvrusb2 driver.  When
> > thepvrusb2 driver is installed into the running kernel, it will tie itself to the other modules
> > thatis needs, but when you modprobe -r pvrusb2, it SHOULD undo all that.  It's conceivable that
> > thesurrounding kernel environment has changed in ways that invalidate this - though I think if
> > thatwere the case I'd see a lot of screaming here :-)  (Either that or almost nobody is using
> > thisanymore...)  -Mike
> > On Fri, 15 Mar 2019, Diego Rivera wrote:Hi!I realize it's been MANY years since you've messed
> > with this driver, but I figured why not ask?Ifthere's a better place/person to send this to,
> > please let me know and I'll be glad to go knockonthat door instead!Here goes: I have a system
> > with two WinTV-HVR-1950 devices (long story, still use analog cablehere)which I've managed to
> > get working with TVHeadend to supply Analog TV support via thedigitalplatform (yay, me!
> > ☺).However, I'm running into a problem due likely to the age of one of the devices
> > (probablystartingto get wonky).  Every so often one of the devices ceases to function and just
> > "dies".  Itneeds tobe physically disconnected (or the machine rebooted) to get back to working
> > order. I'vetried manyapproaches to reset the USB bus or the device itself via software but none
> > of them seemto work:* If I try "modprobe -r pvrusb2" I get the error that the module is in use
> > (but I have nouserprocesses actively using any of the pvrusb2 devices! I've made sure!).* If I
> > try to issueUSBDEVFS_DISCONNECT or USBDEVFS_RESET commands via IOCTL, neither works and areboot
> > is nowrequired.* If I try to reset the whole USB bus via /sys/bus/pci/drivers/?hci_hcd/unbind
> > and bind,it doesn'twork and a reboot is now required* If I try to use
> > /sys/bus/usb/drivers/pvrusb2/unbindand bind, it does'nt work and a reboot is nowrequiredIn the
> > last 3 cases, syslog ends up littered with the message "pvrusb2: Attempted to
> > executecontroltransfer when device not ok", output continually regardless of any attempt to
> > rebind.  Thissuggeststhat once the device is "not ok" (dead?), the driver doesn't attempt to
> > clean it up(should it?)Is there any other way to force a full reset and reinitialization of a
> > pvrusb2 device viasoftwarewithout actually having to disconnect/reconnect the device or reboot
> > the machine?Thanks!
> > 
> > 
> > 
> > 
> > 
> > 
> > 
-- 



Diego Rivera

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: This is a digitally signed message part
URL: <http://www.isely.net/pipermail/pvrusb2/attachments/20190316/ca7f8d9c/attachment.sig>


More information about the pvrusb2 mailing list