Geekzone: technology news, blogs, forums
Guest
Welcome Guest.
You haven't logged in yet. If you don't have an account you can register now.


ianboag

103 posts

Master Geek
+1 received by user: 3

Trusted

#195614 26-Apr-2016 17:57
Send private message

I have a Pi running a weather station and four identical cameras (look at nzfi.avmet.nz if interested). The cameras are /dev/video0, /dev/video1,/dev/video2,/dev/video3.  They are identical right down to each having the same serial number.

 

If I reboot the system, the allocation of cameras to video numbers can be a bit random. I would like each camera to always have the same /dev/videox because I treat each pic differently. I understand this calls for a bit of udev rule stuff. I have to make rules that are based on which port the camera is plugged in to - there are no other distinguishing features.

 

I found this .... seems to be just what I am looking for

 

===========================================

 

If you are not going to be rearranging where they're plugged in then you can do something like:
BUS="usb", ID=="1-4.2:1.0", SYMLINK+="ttyUSBport2"
BUS="usb", ID=="1-4.3:1.0", SYMLINK+="ttyUSBport3"
BUS="usb", ID=="1-4.4:1.0", SYMLINK+="ttyUSBport4"
etc. This works as no matter what order they're initialized in their place on the physical bus is not going to change (unless you unplug one and plug it in somewhere else). I think the ID means controller 1, position 4 (which is a hub), hub port 2 (or 3 or 4), device 1.

 

============================================

 

Here is what lsusb tells me

 

Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. 

 

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

 

Bus 001 Device 012: ID 19d2:0117 ZTE WCDMA Technologies MSM

 

Bus 001 Device 009: ID 0bda:58bb Realtek Semiconductor Corp.

 

Bus 001 Device 011: ID 0bda:58bb Realtek Semiconductor Corp.

 

Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.

 

Bus 001 Device 004: ID 1a40:0101 Terminus Technology Inc. 4-Port HUB

 

Bus 001 Device 005: ID 1a40:0101 Terminus Technology Inc. 4-Port HUB

 

Bus 001 Device 006: ID 1941:8021 Dream Link WH1080 Weather Station / USB Missile Launcher

 

Bus 001 Device 008: ID 0bda:58bb Realtek Semiconductor Corp.

 

Bus 001 Device 010: ID 0bda:58bb Realtek Semiconductor Corp.

 

The cameras are 8,9,10,11

 

Physically this is a Pi model B with four USB ports. One of them is connected to an 8-port hub, the others are empty. The devices (weather station, modem and cameras) are plugged in to the hub.

 

lsusb-t tells me

 

/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=dwc_otg/1p, 480M

 

|__ Port 1: Dev 2, If 0, Class=hub, Driver=hub/5p, 480M

 

|__ Port 1: Dev 3, If 0, Class=vend., Driver=smsc95xx, 480M

 

|__ Port 3: Dev 4, If 0, Class=hub, Driver=hub/4p, 480M

 

|__ Port 1: Dev 5, If 0, Class=hub, Driver=hub/4p, 480M

 

|__ Port 2: Dev 12, If 0, Class=vend., Driver=option, 480M

 

|__ Port 2: Dev 12, If 1, Class=vend., Driver=option, 480M

 

|__ Port 2: Dev 12, If 2, Class=vend., Driver=option, 480M

 

|__ Port 3: Dev 9, If 0, Class='bInterfaceClass 0x0e not yet handled', Driver=uvcvideo, 480M

 

|__ Port 4: Dev 11, If 0, Class='bInterfaceClass 0x0e not yet handled', Driver=uvcvideo, 480M

 

|__ Port 2: Dev 6, If 0, Class=HID, Driver=usbfs, 1.5M

 

|__ Port 3: Dev 8, If 0, Class='bInterfaceClass 0x0e not yet handled', Driver=uvcvideo, 480M

 

|__ Port 4: Dev 10, If 0, Class='bInterfaceClass 0x0e not yet handled', Driver=uvcvideo, 480M

I can't figure the ID=="a-b.c:d.0" bit of the rule for devices 8,9,10,11 ....

IB

 

 

 

 

 


Create new topic

gzt

gzt
18679 posts

Uber Geek
+1 received by user: 7820

Lifetime subscriber

  #1542383 26-Apr-2016 18:56
Send private message

No idea. This guy did it by incorporating device serial number:

http://hintshop.ludvig.co.nz/show/persistent-names-usb-serial-devices/

Advantage you can move host/hub etc but maybe not all devices will have a serial.



ianboag

103 posts

Master Geek
+1 received by user: 3

Trusted

  #1542384 26-Apr-2016 19:02
Send private message

Unfortunately the serial #s are all the same .... the relvant bits from usb-devices ...

 


T: Bus=01 Lev=04 Prnt=05 Port=02 Cnt=02 Dev#= 9 Spd=480 MxCh= 0
D: Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs= 1
P: Vendor=0bda ProdID=58bb Rev=58.01
S: Manufacturer=Generic
S: Product=FULL HD 1080P Webcam
S: SerialNumber=200901010001
C: #Ifs= 4 Cfg#= 1 Atr=80 MxPwr=500mA
I: If#= 0 Alt= 0 #EPs= 1 Cls=0e(video) Sub=01 Prot=00 Driver=uvcvideo

T: Bus=01 Lev=04 Prnt=05 Port=03 Cnt=03 Dev#= 11 Spd=480 MxCh= 0
D: Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs= 1
P: Vendor=0bda ProdID=58bb Rev=58.01
S: Manufacturer=Generic
S: Product=FULL HD 1080P Webcam
S: SerialNumber=200901010001
C: #Ifs= 4 Cfg#= 1 Atr=80 MxPwr=500mA
I: If#= 0 Alt= 0 #EPs= 1 Cls=0e(video) Sub=01 Prot=00 Driver=uvcvideo

T: Bus=01 Lev=03 Prnt=04 Port=02 Cnt=03 Dev#= 8 Spd=480 MxCh= 0
D: Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs= 1
P: Vendor=0bda ProdID=58bb Rev=58.01
S: Manufacturer=Generic
S: Product=FULL HD 1080P Webcam
S: SerialNumber=200901010001
C: #Ifs= 4 Cfg#= 1 Atr=80 MxPwr=500mA
I: If#= 0 Alt= 0 #EPs= 1 Cls=0e(video) Sub=01 Prot=00 Driver=uvcvideo

T: Bus=01 Lev=03 Prnt=04 Port=03 Cnt=04 Dev#= 10 Spd=480 MxCh= 0
D: Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs= 1
P: Vendor=0bda ProdID=58bb Rev=58.01
S: Manufacturer=Generic
S: Product=FULL HD 1080P Webcam
S: SerialNumber=200901010001
C: #Ifs= 4 Cfg#= 1 Atr=80 MxPwr=500mA
I: If#= 0 Alt= 0 #EPs= 1 Cls=0e(video) Sub=01 Prot=00 Driver=uvcvideo

 

 


gzt

gzt
18679 posts

Uber Geek
+1 received by user: 7820

Lifetime subscriber

  #1542394 26-Apr-2016 19:30
Send private message

The address required looks similar to the output of 'udevadm monitor':

http://www.crashcourse.ca/wiki/index.php/Udev

Requires device insertion.

Create new topic








Geekzone Live »

Try automatic live updates from Geekzone directly in your browser, without refreshing the page, with Geekzone Live now.



Are you subscribed to our RSS feed? You can download the latest headlines and summaries from our stories directly to your computer or smartphone by using a feed reader.