Re: udev rule for permissions & symlink for /dev/usb/lp0

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 19-08-09 17:52:05, Eric Smith wrote:
I'm setting up a turnkey system that uses a Zebra brand USB barcode
printer. I need to use it without CUPS, directly printing from an
application. I've verified that this works when my application writes to /dev/usb/lp0. I've had to either run the application as root or change the permissions on /dev/usb/lp0. I though I could solve this problem by using a
udev rule to recognize the printer, create a symlink, and set the
permissions. I created the following rule in
/etc/udev/rules.d/99-zebra.rules.

SUBSYSTEM=="usb", ACTION=="add", ATTRS{idVendor}=="0a5f",
ATTRS{idProduct}=="011c", MODE="0666", SYMLINK+="zebra

This sort of works, but not in any useful way. It does recognize the
printer, but instead of creating the symlink to /dev/usb/lp0 and changing
the permission of that device file, it creates a symlink to e.g.
/dev/bus/usb/001/002, and sets the permissions of that. However, I can't
print to /dev/bus/usb/001/002 (or the symlink to that). Printing to
/dev/usb/lp0 still works fine.

How do I write a udev rule that will set the permission of and symlink to
/dev/usb/lp0 instead of the raw USB device?

I think you want to create a symlink from /dev/usb/lp0 to the new device,
so instead of:

    SYMLINK+="zebra

you want:

    SYMLINK+="usb/lp0"

as on my system, /dev/cdrom is a symlink to /dev/sr0:

$ ll /dev/cdrom
lrwxrwxrwx. 1 root root 3 Aug  9 12:48 /dev/cdrom -> sr0
$ ll /dev/sr0
brw-rw----+ 1 root cdrom 11, 0 Aug  9 12:48 /dev/sr0

You may wish to set a group (and if need be make one) and set mode 660,
for a bit of security.

Note that I don't write UDEV rules myself; this is from looking around.

--
____________________________________________________________________
TonyN.:'                       <mailto:tonynelson@xxxxxxxxxxxxxxxxx>
      '                              <http://www.georgeanelson.com/>
_______________________________________________
users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/users@xxxxxxxxxxxxxxxxxxxxxxx



[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux