[pvrusb2] Ability to fully reset a PVRUSB2 Device

isely at isely.net isely at isely.net
Sat Mar 16 11:26:13 CDT 2019


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't care).

The problem is not that the driver is referencing the USB port but 
rather that other entities are referencing the driver.  So the first 
obvious case is to ensure nobody has it open which you did.  Another 
thing to look at is to see what if other kernel modules are referencing 
the driver.  This might be happening on the digital side.  If you run 
lsmod to get a list of kernel modules installed you should also see 
reference counts and a list of what other kernel modules are causing 
that count to be non-zero.  If there are other modules listed, then they 
need to be removed 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 that basically while the pvrusb2 module will 
reference a lot of other modules to get its job done, I didn't think 
there was any kernel modules that could reference the pvrusb2 driver.  
When the pvrusb2 driver is installed into the running kernel, it will 
tie itself to the other modules that is needs, but when you modprobe -r 
pvrusb2, it SHOULD undo all that.  It's conceivable that the surrounding 
kernel environment has changed in ways that invalidate this - though I 
think if that were the case I'd see a lot of screaming here :-)  (Either 
that or almost nobody is using this anymore...)

  -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? If
> there's a better place/person to send this to, please let me know and I'll be glad to go knock on
> that door instead!
> 
> Here goes: I have a system with two WinTV-HVR-1950 devices (long story, still use analog cable here)
> which I've managed to get working with TVHeadend to supply Analog TV support via the digital
> platform (yay, me! ☺).
> 
> However, I'm running into a problem due likely to the age of one of the devices (probably starting
> to get wonky).  Every so often one of the devices ceases to function and just "dies".  It needs to
> be physically disconnected (or the machine rebooted) to get back to working order. I've tried many
> approaches to reset the USB bus or the device itself via software but none of them seem to work:
> 
> * If I try "modprobe -r pvrusb2" I get the error that the module is in use (but I have no user
> processes actively using any of the pvrusb2 devices! I've made sure!).
> * If I try to issue USBDEVFS_DISCONNECT or USBDEVFS_RESET commands via IOCTL, neither works and a
> reboot is now required.
> * If I try to reset the whole USB bus via /sys/bus/pci/drivers/?hci_hcd/unbind and bind, it doesn't
> work and a reboot is now required
> * If I try to use /sys/bus/usb/drivers/pvrusb2/unbind and bind, it does'nt work and a reboot is now
> required
> 
> In the last 3 cases, syslog ends up littered with the message "pvrusb2: Attempted to execute control
> transfer when device not ok", output continually regardless of any attempt to rebind.  This suggests
> that 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 via software
> without actually having to disconnect/reconnect the device or reboot the machine?
> 
> Thanks!
> 
> 
> 
> 

-- 

Mike Isely
isely @ isely (dot) net
PGP: 03 54 43 4D 75 E5 CC 92 71 16 01 E2 B5 F5 C1 E8


More information about the pvrusb2 mailing list