LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Password
Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.

Notices


Reply
  Search this Thread
Old 04-10-2012, 01:06 PM   #1
Lobinho
Member
 
Registered: May 2010
Distribution: Ubuntu
Posts: 72

Rep: Reputation: 18
USB camera enumeration


Hi,

My board is a mini2440 SDK board, with ARM processor (400mhz) and 64mb ram. Inside it I have a custom rootfs (based on default rootfs) and kernel 2.6.32-2.
I'm working on a project with 2 usb cameras. One camera will be connected
on USB1 and another will be connected on USB2 port of a micro 2440 SDK.


Using above configuration, I have two devices on /dev/:
/dev/video0
/dev/video1

My problem is that I need to know which is connected on USB1 and which is connected on USB2.
For example, /dev/video0 is on USB2 port (1-1.2), and /dev/video1 is on USB1 port (1-1.1).

I tried to write some script calls on /etc/mdev.conf rules (to tell me which USB is being used) (mdev is a kind of udev). This works well when I plug USB cameras while system is running. But it doesn't work well when the system is restarted. The rules are not called properly (i don't know why) during initialization.


In fact, I just need to know where /dev/video0 is connected, USB1 or USB2.
Any file on system can tell me that easily (/sys/bus/usb/...), instead of write a lot of scripts?


Thanks in advance.
 
Old 04-11-2012, 10:25 PM   #2
david1941
Member
 
Registered: May 2005
Location: St. Louis, MO
Distribution: CentOS7
Posts: 267

Rep: Reputation: 58
I don't know if this will help but I had a problem figuring out where my scanner was mounted and used the lsusb command like this
Code:
# Determine scanning device - Epsom Prefection 640U attached (we hope)
DEVBUS=`/sbin/lsusb |grep Epson|cut -d " " -f2`
DEVDEV=`/sbin/lsusb |grep Epson|cut -d " " -f4`
DEVDEV=`echo $DEVDEV |sed s/://`
SANE_DEFAULT_DEVICE="epson:libusb:$DEVBUS:$DEVDEV"
[ -z "$DEVDEV" ] && SANE_DEFAULT_DEVICE=""
# The above discovers the usb device.  If power has cycled on the scanner, 
# the usb port changes, therefore using the environment doesn't always work. 

[ -n $SANE_DEFAULT_DEVICE ] || (echo "Cannot find the scanner!" && exit 1)
It might work for you purposes.
 
Old 04-13-2012, 12:43 PM   #3
Lobinho
Member
 
Registered: May 2010
Distribution: Ubuntu
Posts: 72

Original Poster
Rep: Reputation: 18
Hi David,

Thanks for your response. I had forgot about the 'lsusb' command.
I don't have lsusb cross-compiled for ARM, so I did some tests on PC. The main problem is that I don't know exactly what usb camera my client will use... I have to support any.

I'll try to understand better the output of lsusb, and try to find a solution with this tool.

Thanks,
 
  


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
[SOLVED] pic16c745 shipped with out firmware ? usb enumeration fails PoleStar Linux - Embedded & Single-board computer 2 03-22-2012 12:33 PM
Linux USB Enumeration Vs Windows USB Enumeration rajasekarpadmanaban Linux - Software 1 05-02-2007 03:36 AM
Netfinity 4000R USB enumeration problem KimVette Linux - Hardware 2 04-19-2007 12:43 AM
USB - HID device enumeration process anmol_ranka Programming 1 04-18-2007 12:50 PM
USB Logitech STX Camera | sytem startup camera active problem delta function Slackware 0 08-06-2006 04:23 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer

All times are GMT -5. The time now is 08:12 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