Bug 159306 - multimedia/webcamd: New rc script with $webcamd_device
Summary: multimedia/webcamd: New rc script with $webcamd_device
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Hans Petter Selasky
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-30 08:40 UTC by lichray
Modified: 2014-07-10 12:59 UTC (History)
2 users (show)

See Also:


Attachments
webcamd_rc_2.patch (2.57 KB, patch)
2011-07-30 08:40 UTC, lichray
no flags Details | Diff
webcamd_rc_2.patch.2 (2.65 KB, application/octet-stream)
2011-08-03 06:02 UTC, lichray
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description lichray 2011-07-30 08:40:08 UTC
	
	The current rc script is just unusable. It requires your to pass
	the device name by hand.

Fix: I added a $webcamd_device variable, and changes pidfile accordingly.

	Note that the pid in the $pidfile is wrong, and I fixed it by hacking
	into the file content.

	I'm not pro at writing rc script. Please help me improve it, thx.
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2011-07-30 08:40:24 UTC
Responsible Changed
From-To: freebsd-ports-bugs->hselasky

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 lichray 2011-08-03 06:02:45 UTC
An updated version which deletes the fixed pidfile.

-- 
Zhihao Yuan, nickname lichray
The best way to predict the future is to invent it.
___________________________________________________
4BSD -- http://4bsd.biz/
Comment 3 Eitan Adler freebsd_committer freebsd_triage 2012-01-30 13:43:50 UTC
State Changed
From-To: open->closed

Committed. Thanks!
Comment 4 Duane 2014-07-10 05:31:21 UTC
This fix isn't in the current source tree which means webcamd fails silently if the device isn't provided, and in fact all of the service commands are silent.

Also, is it possible to have this automatically detect the device when daemonising, the same as it does when run in the foreground?
Comment 5 Duane 2014-07-10 05:50:26 UTC
(In reply to Duane from comment #4)
> Also, is it possible to have this automatically detect the device when
> daemonising, the same as it does when run in the foreground?

Never mind this, I've just seen that it uses devd to achieve this.
Comment 6 Hans Petter Selasky freebsd_committer freebsd_triage 2014-07-10 07:01:30 UTC
Hi,

Can you add to the script support for multiple devices, that the webcamd rc.d script will iterate a webcamd_device_0,1, 2,3 list, or maybe space separated:

webcamd_device="ugenX.X ugenY.Y" ...

--HPS
Comment 7 Duane 2014-07-10 07:41:27 UTC
This patch isn't mine, I just found in in the bugtracker while I was trying to figure out why I couldn't interact with webcamd through the service command, and I noted that this bug is marked as closed -> Committed, even though it doesn't appear in the source.

I was really just intending to draw attention to the fact that `service webcamd status|stop|start|restart` does nothing, not even report an error.  This patch would resolve that and the bugtracker claims that it was committed while the source shows it is not.

Upon further reflection, if this patch had been included I probably would not have learnt of the relation between this service and the devd facility and would have manually entered the device in rc.conf which would likely have blown up if the device was ever moved to a different hub on the computer.

I'll see if I can figure out how to make the service command trigger sensible behaviour from the rc script in light of its relation to devd, and if I come up with something I'll submit it as a separate request.

Regards,

Duane.
Comment 8 dreamcat4 2014-07-10 08:32:38 UTC
OK. I am re-writing this rc.d script to include the following variable:

webcamd_devices="ugenX.X ugenY.Y" …

And loop through the list, starting a new instance of webcamd for each device.

For stop / status / restart, I shall be using prep & pill to match all running processes (rather than pidfile). This seems less hassle.

The only thing I'm not sure what to do is with the "interface number" argument. Because I have not seen any reason to use it myself yet. Is it really necessary to specify explicitly? My devices seem to work fine without using it.

Also:

Launching multiple separate instances of webcamd (one instance for each device). This is not difficult. However what may be difficult is to set different kinds of "webcamd_flags" for each of the individual instances. I may not be able provide such an elegant solution for achieving that kind of finer control.
Comment 9 dreamcat4 2014-07-10 12:59:12 UTC
OK. I have finished brand new rc.d script and submitted it as PR 191781

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=191781

Many thanks.