Page 1 of 2
Permenantly setting permissions for /dev/ttyUSB*
Posted: 2012/01/30 12:18:37
by nikkilocke
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)
Re: Permenantly setting permissions for /dev/ttyUSB*
Posted: 2012/01/30 12:26:31
by TrevorH
What does `ls -la /dev/ttyUSB*` say with the standard udev rules in place?
Re: Permenantly setting permissions for /dev/ttyUSB*
Posted: 2012/01/30 13:43:04
by nikkilocke
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?
Re: Permenantly setting permissions for /dev/ttyUSB*
Posted: 2012/01/30 17:06:07
by nikkilocke
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!
Re: Permenantly setting permissions for /dev/ttyUSB*
Posted: 2012/01/31 10:12:29
by pschaff
[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]
Re: Permenantly setting permissions for /dev/ttyUSB*
Posted: 2012/01/31 15:01:03
by nikkilocke
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 :-)
Re: Permenantly setting permissions for /dev/ttyUSB*
Posted: 2012/01/31 22:57:33
by pschaff
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.
Re: Permenantly setting permissions for /dev/ttyUSB*
Posted: 2012/02/01 10:06:04
by nikkilocke
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!
Permenantly setting permissions for /dev/ttyUSB*
Posted: 2012/02/01 14:27:24
by gerald_clark
You still have not answered the question in post #2.
You might need to add your users to the terminal's group.
Re: Permenantly setting permissions for /dev/ttyUSB*
Posted: 2012/02/01 14:32:45
by nikkilocke
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.