0

I'm trying to create a video device for my DSLR camera on USB. Nothing shows up in /dev/ out of the box.

Steps

$ lsusb
...
Bus 001 Device 010: ID 04a9:3270 Canon, Inc. 
...

I'll use these Bus and Device numbers to get attributes from udevadm:

$ sudo udevadm info --attribute-walk /dev/bus/usb/001/010

  looking at device '/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.5':
    KERNEL=="1-1.5"
    SUBSYSTEM=="usb"
    DRIVER=="usb"
    ...
    ATTR{ltm_capable}=="no"
    ATTR{manufacturer}=="Canon Inc."
    ATTR{maxchild}=="0"
    ATTR{product}=="Canon Digital Camera"
    ATTR{quirks}=="0x0"
    ...

  looking at parent device '/devices/pci0000:00/0000:00:1a.0/usb1/1-1':
    KERNELS=="1-1"
    ...

From there I expected to be able to create a udev rule to (for starters) print a message to a file.

$ cat /tmp/test.sh
#!/usr/bin/env bash
echo "asdf" >> /tmp/dslr-udev-test.txt

Permissions to execute:

$ ls -l /tmp/test.sh
-rwxrwxr-x 1 gauthier gauthier 59 Jun 23 22:54 /tmp/test.sh

Then to the udev rule itself:

$ cat /etc/udev/rules.d/90-canon-dslr.rules 
SUBSYSTEM=="usb", ACTION=="add", ATTR{product}=="Canon Digital Camera", RUN+="/tmp/test.sh"

No output comes to the output file, which I watch with tail -f.

1 Answer 1

0

Apparently, you can't use #!/usr/bin/env bash in that context.

Replacing it with #!/bin/sh worked.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .