Closed Bug 845049 Opened 11 years ago Closed 11 years ago

Camera - emulator - can't open real camera, "Camera device '/dev/video0' is in use"

Categories

(Firefox OS Graveyard :: General, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: mikeh, Unassigned)

References

Details

Attachments

(1 file, 1 obsolete file)

The attached patch is supposed to allow the b2g emulator to use real camera hardware, if present on the host system.

On a Lenovo Thinkpad X220 running Ubuntu 12.10 x86_64, the laptop's webcam shows up as /dev/video0 and works in other applications (e.g. Skype); but on starting the emulator and opening the camera app, the following error is emitted:

emulator: ERROR: _camera_client_create: Camera device '/dev/video0' is in use

Various commands[1] show that no one seems to have /dev/video0 open.

1. http://superuser.com/questions/97844/how-can-i-determine-what-process-has-a-file-open-in-linux
It looks like on Ubuntu 12.10, users are created without belonging to the 'video' group, which is required to access /dev/video0.  The following command addresses this issue:

# sudo usermod -a -G video <userid>

With that done, logcat shows the following:

D(  281:0x119) Emulated camera list: name=/dev/video0 channel=0 pix=1448695129 dir=back framedims=640x480,640x360,352x288,320x240,800x448,960x544,1280x720,424x240
V(  281:0x119) Initialize:
V(  281:0x119)    Name=/dev/video0
V(  281:0x119)    Facing 'back'
V(  281:0x119)    Dimensions=640x480,640x360,352x288,320x240,800x448,960x544,1280x720,424x240
E(  281:0x119) connectClient: Unable to connect to the camera service 'name=/dev/video0': Invalid argument
D(  281:0x119) Initialize: Fake camera is facing none
V(  281:0x119) 1 cameras are being emulated. Fake camera ID is 0
I(  281:0x119) 1074238600[42607160]: getListOfCameras : get_number_of_cameras() returned 1

sotaro, any chance your patch(es) in bug 803471 will address not being able to connect to the camera service?
Flags: needinfo?(sotaro.ikeda.g)
(In reply to Mike Habicher [:mikeh] from comment #1)
> 
> sotaro, any chance your patch(es) in bug 803471 will address not being able
> to connect to the camera service?

After applying the patch, it works!!! And preview screen is rendered correctly.
Flags: needinfo?(sotaro.ikeda.g)
(In reply to Sotaro Ikeda [:sotaro] from comment #2)
> (In reply to Mike Habicher [:mikeh] from comment #1)
> > 
> > sotaro, any chance your patch(es) in bug 803471 will address not being able
> > to connect to the camera service?
> 
> After applying the patch, it works!!! And preview screen is rendered
> correctly.

PC camera's video is rendered on preview. And a taken picture is also image from PC's camera.
(In reply to Sotaro Ikeda [:sotaro] from comment #2)
> 
> After applying the patch, it works!!! And preview screen is rendered
> correctly.

\o/ \o/ \o/ \o/ \o/ \o/ \o/

We should get your patch landed.  :)
Depends on: 803471
Attachment #718082 - Attachment is obsolete: true
Attachment #723949 - Flags: review?(mwu)
Attachment #723949 - Flags: review?(mwu) → review+
Merged.
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: