Author Topic: 檢查及設定 Serial Port (/dev/ttyS0)  (Read 6846 times)

admin

  • Administrator
  • *****
  • Posts: 0
    • View Profile
檢查及設定 Serial Port (/dev/ttyS0)
« on: September 17, 2012, 05:59:18 PM »
How To Check and Use Serial Ports Under Linux
http://www.cyberciti.biz/faq/find-out-linux-serial-ports-with-setserial/#comments

Simple run dmesg command
 $ dmesg | grep tty

setserial command
setserial is a program designed to set and/or report the configuration information associated with a serial port. This information includes what I/O port and IRQ a particular serial port is using, and whether or not the break key should be interpreted as the Secure Attention Key, and so on. Just type the following command:
 $ setserial -g /dev/ttyS[0123]

Current User Rights
1) ls -la /dev/ttyS0 — This will report the permissions on the port. Typically, this will say crw-rw—- 1 root uucp. The “c” in the string indicates that it’s a “character device” the first “rw” indicates that the owner has read/write permission. The second “rw” means that the group has read/write permissions. The “—” indicates that the rest of the world has no permissions. After the “—-”, “root” indicates that the owner of the device is root, and that the group id is “uucp”. So, you either need to be root, or a member of the uucp group to have read/write access to the port.

2) To add yourself to the uucp group (to get read/write access), you need to edit the file /etc/group, and add your user name to the line that begins with “uucp:” User names are separated by commas, so add a comma, then your user name to the end of the line. You will need root permissions to edit this file.

3) log out, and log back in because group associations are made at login time, and are not queried on each request.

« Last Edit: September 17, 2012, 06:01:41 PM by Roy Chan »