Permenantly setting permissions for /dev/ttyUSB*

Issues related to hardware problems
nikkilocke
Posts: 96
Joined: 2006/03/28 15:59:00
Contact:

Permenantly setting permissions for /dev/ttyUSB*

Post by nikkilocke » 2012/01/30 12:18:37

I wish to give ordinary users read/write access to /dev/ttyUSB* (so till software at a shop can control the till roll printer and open the till drawer).

It seems every release of CentOs changes how this should be done!
In CentOs 5, I edited /etc/udev/rules.d/50-udev.rules. I understand in CentOs 6 the rules are now in /lib/udev/rules.d, but I can't find any reference to ttyUSB in that folder, other than:

60-persistent-serial.rules(5): KERNEL!="ttyUSB[0-9]*|ttyACM[0-9]*", GOTO="persistent_serial_end"

Where should I add a rule to do the equivalent of the CentOs 5 line:

/etc/udev/rules.d/50-udev.rules:KERNEL=="ttyUSB*", GROUP="epos", MODE="0666"

(and what shoulld the rule say)

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Permenantly setting permissions for /dev/ttyUSB*

Post by TrevorH » 2012/01/30 12:26:31

What does `ls -la /dev/ttyUSB*` say with the standard udev rules in place?

nikkilocke
Posts: 96
Joined: 2006/03/28 15:59:00
Contact:

Re: Permenantly setting permissions for /dev/ttyUSB*

Post by nikkilocke » 2012/01/30 13:43:04

This was more of an exploratory question - I am testing and debugging my install scripts on a VM, and I don't think I can attach the actual USB hardware to the VM (I don't have drivers for the host O/S).

However, I am burning a real CentOs 6 DVD as we speak, preparatory to installing it on a real box, so I'll let you know.

In the mean time, a pointer to documentation on how the CentOs 6 rules work would be nice?

nikkilocke
Posts: 96
Joined: 2006/03/28 15:59:00
Contact:

Re: Permenantly setting permissions for /dev/ttyUSB*

Post by nikkilocke » 2012/01/30 17:06:07

Turns out I won't be able to answer your question for a while - CentOs 6 won't install on the old target hardware I have to hand (no pae or cx8, so I have to wait for the client to decide on and procure the new target hardware before I can actually check out the printer hardware.

So an answer based on theory, rather than practice, would be nice!

pschaff
Retired Moderator
Posts: 18276
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America
Contact:

Re: Permenantly setting permissions for /dev/ttyUSB*

Post by pschaff » 2012/01/31 10:12:29

[quote]
nikkilocke wrote:
This was more of an exploratory question - I am testing and debugging my install scripts on a VM, and I don't think I can attach the actual USB hardware to the VM (I don't have drivers for the host O/S).[/quote]
Perhaps not relevant to CentOS, but it is a rare host OS that does not have native USB drivers. Many virtualization methods allow USB passthrough.

[quote]
In the mean time, a pointer to documentation on how the CentOs 6 rules work would be nice?[/quote]

How about some help from a google on [url=http://www.google.com/search?q=%22%2Fetc%2Fudev%2Frules.d%2F%22+%22%2Flib%2Fudev%2Frules.d%2F%22+site%3Aredhat.com&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a]"/etc/udev/rules.d/" "/lib/udev/rules.d/" site:redhat.com[/url]?

First, according to [url=https://bugzilla.redhat.com/show_bug.cgi?id=464844#c3]upstream[/url]:
"/lib/udev/rules.d is for operating system provided rules that shouldn't be edited. /etc/udev/rules.d is for system-specific configuration"

For details see the [url=http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Logical_Volume_Manager_Administration/udev_device_manager.html]upstream docs.[/url]

nikkilocke
Posts: 96
Joined: 2006/03/28 15:59:00
Contact:

Re: Permenantly setting permissions for /dev/ttyUSB*

Post by nikkilocke » 2012/01/31 15:01:03

Thanks for the pointer to the upstream docs. Is there no corresponding doc website for CentOs? (It might work a bit better - the search results page in the RedHat one is a total mess when viewed with Chrome.)

I have read that page, and the adjoining ones (which seem to be about Logical Volumne Management, which, AFAIK, is something to do with disks. I have copied the sample rules file from .usr/share/docs/device-mapper* into /lib/udev/rules.d

I am still totally baffled as to how to write a rule which will match /dev/ttyUSB*, and set the ownership and permissions.

What is a "DM device"?

Do I put in a rule like:

KERNEL=="ttyUSB*", GROUP="epos", MODE="0666"

or do the rules in this file have to begin with "ENV{DM"

Are the rules executed in filename alphanumeric order? If so, what happens if 2 rules match the same device?

Will the rule at the start of this file
ENV{DM_UDEV_RULES_VSN}!="?*", GOTO="dm_end"

cause any rules I add later to be skipped?

Am I even using the right file?

Am I alone in wanting to read some documentation which tells me what to do, instead of fiddling about to find out what works?

Sorry, I'm getting carried away now :-)

pschaff
Retired Moderator
Posts: 18276
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America
Contact:

Re: Permenantly setting permissions for /dev/ttyUSB*

Post by pschaff » 2012/01/31 22:57:33

CentOS has yet to get their act together with hosting the EL6 documentation. Sorry I can't answer your questions without research, and no time now.

nikkilocke
Posts: 96
Joined: 2006/03/28 15:59:00
Contact:

Re: Permenantly setting permissions for /dev/ttyUSB*

Post by nikkilocke » 2012/02/01 10:06:04

Thanks for the help you have given, I appreciate it.

I guess I will wait until I have the target hardware, and fiddle about until I get something that works.

I hate that, but I suppose I'm using a free operating system, and shouldn't complain!

gerald_clark
Posts: 10642
Joined: 2005/08/05 15:19:54
Location: Northern Illinois, USA

Permenantly setting permissions for /dev/ttyUSB*

Post by gerald_clark » 2012/02/01 14:27:24

You still have not answered the question in post #2.
You might need to add your users to the terminal's group.

nikkilocke
Posts: 96
Joined: 2006/03/28 15:59:00
Contact:

Re: Permenantly setting permissions for /dev/ttyUSB*

Post by nikkilocke » 2012/02/01 14:32:45

Do you mean the question asked by TrevorH?

If so, I answered as best I could in posts #3 and #4 - I am not in a position to run the command you suggest, because I am unable to install CentOs on the hardware I have here, and I am unable to attach the relevant device to the VM I am testing in.

I will have to wait until I have CentOs installed on hardware to which I can attach the printer before I can proceed further.

Post Reply