After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 603612 - CheeseCamera should support hotplug
CheeseCamera should support hotplug
Status: RESOLVED OBSOLETE
Product: cheese
Classification: Applications
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: Patricia Santana Cruz
Cheese Maintainer(s)
Depends on: 662852
Blocks:
 
 
Reported: 2009-12-02 15:47 UTC by Bastien Nocera
Modified: 2020-11-12 07:12 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add CheeseCameraDeviceMonitor::removed signal callback. (2.03 KB, patch)
2011-10-28 15:18 UTC, Patricia Santana Cruz
committed Details | Review
Preferences dialog supports hotplug (11.01 KB, patch)
2011-11-04 13:27 UTC, Patricia Santana Cruz
committed Details | Review
CheeseCamera supports hotplug from 0 to 1 devices. (6.05 KB, patch)
2012-02-09 15:09 UTC, Patricia Santana Cruz
none Details | Review

Description Bastien Nocera 2009-12-02 15:47:18 UTC
SSIA
Comment 1 Filippo Argiolas 2009-12-02 15:56:12 UTC
I'll add support for this when I'll drop hal for gudev. Expect first bits of real code for the next week, hoping the exam will go well :)
Comment 2 daniel g. siegel 2010-08-09 00:31:20 UTC
any news on this?
Comment 3 Filippo Argiolas 2010-09-07 16:59:47 UTC
Ehm, exam went well, then another one did and another one and so on...
Sorry I'm trying to avoid these kind of false promises these days :-P.
Time is always too little and runs fast so if anybody else wants to work on this please leave a note here and do it.
Comment 4 Luciana Fujii 2011-06-20 22:41:58 UTC
Cheese now uses gudev. I never tried hotplug, but it should work looking at the code. Can we close this bug?
Comment 5 Bastien Nocera 2011-06-21 09:22:36 UTC
No, test it first :)
Comment 6 Luciana Fujii 2011-06-21 14:47:10 UTC
hehe. My intention was to actually ask if this works for people that can test it. I don't have a pluggable camera on me, can someone test? Pretty please?
Comment 7 David King 2011-10-26 16:29:22 UTC
I investigated this with Patricia today, and we discovered that hotplug in Cheese does not work. The CheeseCameraDeviceMonitor created during CheeseCamera setup is destroyed almost immediately afterwards with a call to g_object_unref():

http://git.gnome.org/browse/cheese/tree/libcheese/cheese-camera.c#n282

Therefore, the ‘added’ signal is never emitted. Additionally, the ‘removed’ signal was not connected to a handler, so no hotplug events were being processed.

To solve this bug, a handler for the ‘removed’ signal needs to be added and hooked up, the device monitor needs to be made a member of the CheeseCamera (or wherever else is suitable in order to manage the lifetime) and there needs to be some handling of adding the first video device, so that the user does not have to explicitly select it in the preferences.

As Patricia understands the problem and is happy to solve it, I have assigned the bug to her.
Comment 8 Patricia Santana Cruz 2011-10-28 15:18:44 UTC
Created attachment 200180 [details] [review]
Add CheeseCameraDeviceMonitor::removed signal callback.

This patch gives hotplug support to cheese. Devices get added and removed from the list of devices in the CheeseCamera, however, these changes are not propagated to the UI yet. This is what I will start working on now.
Comment 9 David King 2011-10-28 16:05:30 UTC
Comment on attachment 200180 [details] [review]
Add CheeseCameraDeviceMonitor::removed signal callback.

Pushed to master as commit 63c5ec91ea6a54f6b2a50fc10abf62f155b9e38e, thanks!
Comment 10 Patricia Santana Cruz 2011-11-04 13:27:44 UTC
Created attachment 200686 [details] [review]
Preferences dialog supports hotplug

The preferences dialog supports now hotplug. Changes made in the number of camera devices (adding or removing) are now propagated to the UI, in the preferences dialog. Both cases, adding the first device and removing the last device, still need some further investigation to be solved in a suitable way. This part, might have to be done in the CheeseCamera instead of the PreferencesDialog.
Comment 11 David King 2011-11-04 14:50:14 UTC
Comment on attachment 200686 [details] [review]
Preferences dialog supports hotplug

Pushed a slightly-modified commit to master as commit 884e34e97a13e049fc538a3b030b9bce38aa8d63, thanks!
Comment 12 Patricia Santana Cruz 2012-02-09 15:09:35 UTC
Created attachment 207197 [details] [review]
CheeseCamera supports hotplug from 0 to 1 devices.

This patch partially solves the bug, giving support to CheeseCamera for hotplug connections when going from 0 to 1 devices.
Comment 13 Hans de Goede 2013-09-03 14:14:11 UTC
Cheese's hotplug support still is not ideal, starting with 0 devices leads to a bunch of glib CRITICAL messages, and if a camera is plugged in later, it cannot be used without restarting cheese, likewise going from 1 -> 0 or 1 -> 0 -> 1 devices is not handled cleanly.

I've pushed a patchset on top of the latest master here:
http://cgit.freedesktop.org/~jwrdegoede/cheese/

Which fixes all of this, note the first 4 patches on top of master are unrelated and I've attached these to separate bugs.

As discussed in bug 702264 "calling cheese_camera_setup() in the preferences dialogue" is not ideal, as explained in the commit message I've done things this way since a bunch of the camera control (resolution, device selection) is already done from the preferences-dialog code. This can probably best be fixed by adding a separate camera control object / class.  But since cheese's behavior wrt this currently is rather ugly, I would like to suggest to first just merge the patches fixing all this as is, so that cheese users are not confronted with these issues, then the underlying code can be cleaned up later.
Comment 14 Hans de Goede 2013-09-17 13:20:48 UTC
I've rebased my hotplug fixes patches on top of 3.9.92, you can find the new set here:
http://cgit.freedesktop.org/~jwrdegoede/cheese/log/
Comment 15 AJ Jordan 2017-08-31 19:32:04 UTC
Can someone either accept or reject Hans' patches? I've got a hardware kill switch and this is annoying. Plus this bug has been sitting open forever.
Comment 16 Bastien Nocera 2017-08-31 19:36:08 UTC
(In reply to AJ Jordan from comment #15)
> Can someone either accept or reject Hans' patches? I've got a hardware kill
> switch and this is annoying. Plus this bug has been sitting open forever.

The patches aren't attached to the bug, so they're not visible in any reports about unreviewed patches. I would also expect them not to apply cleanly anymore.

Hans, could you please git-bz attach the patches here after having rebased them on master? Thanks.
Comment 17 André Klapper 2020-11-12 07:12:10 UTC
bugzilla.gnome.org is being replaced by gitlab.gnome.org. We are closing all
old bug reports and feature requests in GNOME Bugzilla which have not seen
updates for a long time.

If you still use cheese and if you still see this bug / want this feature in a
recent and currently supported version, then please feel free to report it at
https://gitlab.gnome.org/GNOME/cheese/-/issues/

Thank you for creating this report and we are sorry it could not be implemented
(volunteer workforce and time is quite limited).