Announcement

Collapse
No announcement yet.

Lock a device to a specific entry in /dev

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Lock a device to a specific entry in /dev

    I have a tuner card and a webcam. When I boot up these devices are detected and the entries in /dev are video0 and video1. The problem is that it switches the devices at boot. Each time I boot I never know which is video0 and which is video1. I have a launcher for VLC that opens the tuner card so that I can watch TV. I have guvcview to use the webcam. I have to modify the launcher for each to use the correct device almost every time I want to use them. Is there a way to lock these devices to a specific entry in /dev at boot?

    #2
    Re: Lock a device to a specific entry in /dev

    I had the same problem and it irritated me enough that I gave the webcam on my desktop PC away and just use the one on my netbook

    The only way I know is to write a udev rule but I have no experience there. This may help -

    http://hackaday.com/2009/09/18/how-to-write-udev-rules/
    we see things not as they are, but as we are.
    -- anais nin

    Comment


      #3
      Re: Lock a device to a specific entry in /dev

      That's a little over my head. I just came up with an easier solution. I'll just unplug the webcam, which is a USB device and leave it unplugged until I need it.

      Comment


        #4
        Re: Lock a device to a specific entry in /dev

        Originally posted by Detonate
        That's a little over my head. I just came up with an easier solution. I'll just unplug the webcam, which is a USB device and leave it unplugged until I need it.
        So you basically came up with the same solution I did
        we see things not as they are, but as we are.
        -- anais nin

        Comment


          #5
          Re: Lock a device to a specific entry in /dev

          I think all you need is to get the output from

          udevadm info -a -p $(udevadm info -q path -n /dev/video0)


          match the device to the vendor/product id from lsusb

          and create your file /etc/udev/rules.d/50-usbcamera.rules and put something like:

          Code:
          SUBSYSTEM=="video4linux", BUS=="usb", SYSFS{idVendor}=="XXXX", SYSFS{idProduct}=="XXXX", NAME="video0"
          in it and repeat for the other device.

          Shouldn't be too hard.

          Please Read Me

          Comment


            #6
            Re: Lock a device to a specific entry in /dev

            I'll play around with that and see if I can get it to work. Once the first device is set, there should not be any need to set the second device should there? It would automatically grab the next number I think.

            Comment


              #7
              Re: Lock a device to a specific entry in /dev

              Yeah, I think that's right. Can't hurt to try - you can always delete it if it doesn't work.

              Please Read Me

              Comment

              Working...
              X