LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 04-19-2013, 12:23 AM   #1
jhdalben
LQ Newbie
 
Registered: Oct 2011
Posts: 18

Rep: Reputation: Disabled
USB Camera mount and unmount, like Android


Hi. I would like to know what does Android (4.0.3) do to mount and unmount (basically offer power supply to it) camera when needed. If you do a lsusb on a terminal after booting, it says there is no camera at all. But when you launch the camera application, if you check lsusb again (and dmesg) it is mounted upon request. As soon as you close the application, it unmounts the camera, probably to save power.

Does anyone know anything about this Android trick to power devices just when it needs a specific device?

Why am I asking this:

On my single-board notebook, I have 32-bit Ubuntu 10.04 running on SD Card and Android 4.0.3 on flash memory.

Ubuntu doesn't recognize the camera, because apparently it doesn't offer any power supply to it (like Android, to save power). If I connect a wire between a powered USB port and the camera USB port, then it recognizes the camera, but if I disconect the wire, it unmounts.

If I remove the SD Card and reboot, then Android comes up. It also doesn't recognize the camera after boot. But as soon as I launch the camera application, somehow the USB gets powered and the camera is recognised.

(If possible, where could I find the source code containing the operations executed by the camera app?)

EDIT:

This is the lsusb output on Ubuntu when the USB camera port gets a power supply through the wire I connect

Code:
$ lsusb
Bus 003 Device 002: ID 04d9:2ba0 Holtek Semiconductor, Inc. 
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 013: ID 1e4e:0102  
Bus 001 Device 004: ID 0bda:8176 Realtek Semiconductor Corp. 
Bus 001 Device 002: ID 05e3:0608 Genesys Logic, Inc. USB-2.0 4-Port HUB
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Here is the normal lsusb output on Ubuntu, without the USB camera/port being recognized

Code:
$ lsusb
Bus 003 Device 002: ID 04d9:2ba0 Holtek Semiconductor, Inc. 
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 004: ID 0bda:8176 Realtek Semiconductor Corp. 
Bus 001 Device 002: ID 05e3:0608 Genesys Logic, Inc. USB-2.0 4-Port HUB
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
This is dmesg on Ubuntu when I connect the wire. Notice it disconnects cause it's not easy to stand still holding the wire :P

Code:
$ dmesg | tail    
[  483.790202] uvcvideo: Found UVC 1.00 device USB2.0 Camera (1e4e:0102)    
[  483.797666] input: USB2.0 Camera as /devices/pci0000:00/0000:00:04.0/usb1/1-1/1-1:1.0/input/input4    
[  484.608278] usb 1-1: USB disconnect, device number 8    
[  486.123368] usb 1-1: new high speed USB device number 9 using ehci_hcd
[  486.258975] usb 1-1: device descriptor read/all, error -71    
[  486.320237] hub 1-0:1.0: unable to enumerate USB device on port 1    
[  486.896696] usb 1-1: new high speed USB device number 11 using ehci_hcd    
[  487.040213] uvcvideo: Found UVC 1.00 device USB2.0 Camera (1e4e:0102)    
[  487.047682] input: USB2.0 Camera as /devices/pci0000:00/0000:00:04.0/usb1/1-1/1-1:1.0
/input/input5    
[  491.890035] usb 1-1: USB disconnect, device number 11
 
Old 04-19-2013, 05:14 PM   #2
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
Quote:
I would like to know what does Android (4.0.3) do to mount and unmount (basically offer power supply to it) camera when needed. If you do a lsusb on a terminal after booting, it says there is no camera at all. But when you launch the camera application, if you check lsusb again (and dmesg) it is mounted upon request. As soon as you close the application, it unmounts the camera, probably to save power.

Does anyone know anything about this Android trick to power devices just when it needs a specific device?
The behavior you describe is controlled by udev.

To identify your camera, with the camera unplugged, open a terminal and run this command: udevadm monitor. That will setup a monitor to watch for udev events.

Now plug in the camera. The mount event will identify the camera as a device.

You can do some research on writing udev rules, and write a rule to automount/umount the camera.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How Mount/Unmount Local USB drive in LTSP Client? levglonti Linux - Server 0 02-22-2010 02:03 PM
usb in mount/unmount loop vishesh Linux - Kernel 1 04-09-2009 06:28 AM
usb mount and unmount vishesh Linux - Newbie 5 12-05-2008 03:57 AM
mount USB Camera FC3 frs Fedora 7 03-14-2005 05:57 PM
USB Camera Will Only Mount Once Glock Shooter Linux - Hardware 9 02-05-2005 08:26 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 09:39 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration