-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sit dokumentasie protokol by en alle bronleers vanaf PhotoVoltaik
- Loading branch information
Showing
9 changed files
with
842 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,259 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 26, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Toets die pylontech seriepoort kommunikasie\n", | ||
"import sys\n", | ||
"import pylonpacket\n", | ||
"import logging\n", | ||
"import serial\n", | ||
"import time\n", | ||
"\n", | ||
"\n", | ||
"\n", | ||
"class PylonCom:\n", | ||
" PORT = \"/dev/ttyUSB0\"\n", | ||
" BAUD = 115200\n", | ||
" \n", | ||
" def __init__(self):\n", | ||
" self.sp = serial.Serial(PylonCom.PORT,PylonCom.BAUD,timeout=0.5)\n", | ||
"\n", | ||
" def GetReply(self, request, reply_type):\n", | ||
" self.sp.write(request.GetAsciiBytes())\n", | ||
" line = bytearray()\n", | ||
" while True:\n", | ||
" c = self.sp.read(1)\n", | ||
" if c:\n", | ||
" line.extend(c)\n", | ||
" if c[0] == 0x0D:\n", | ||
" break\n", | ||
" else:\n", | ||
" break\n", | ||
" logging.debug(\"Received sentence %s\",line)\n", | ||
" preply = pylonpacket.PylonPacket.Parse(line, reply_type)\n", | ||
" return preply\n", | ||
"\n", | ||
" def close(self):\n", | ||
" self.sp.close()\n", | ||
"\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 32, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"Get system parameter: VER: 0x20, ADR: 0x02, CID1: 0x46, CID2: 0x47, LENGTH: 0, len(INFO): 0, CHKSUM: 0x0000\n", | ||
"Get system parameter reply: None\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"pc = PylonCom()\n", | ||
"\n", | ||
"ppIn = pylonpacket.PPGetSystemParameter()\n", | ||
"print(\"Get system parameter:\",ppIn)\n", | ||
"ppOut = pc.GetReply(ppIn, pylonpacket.PPSystemParameter)\n", | ||
"print(\"Get system parameter reply:\",ppOut)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 30, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"Get system parameter: VER: 0x20, ADR: 0x02, CID1: 0x46, CID2: 0x47, LENGTH: 0, len(INFO): 0, CHKSUM: 0x0000\n", | ||
"Get series number: VER: 0x20, ADR: 0x02, CID1: 0x46, CID2: 0x93, LENGTH: 2, len(INFO): 1, CHKSUM: 0x0000, Command: 2\n" | ||
] | ||
}, | ||
{ | ||
"ename": "ValueError", | ||
"evalue": "Invalid packet format", | ||
"output_type": "error", | ||
"traceback": [ | ||
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", | ||
"\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)", | ||
"\u001b[0;32m<ipython-input-30-bfedc3b1d0c8>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 9\u001b[0m \u001b[0mppIn\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mCommand\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;36m0x02\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 10\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"Get series number:\"\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mppIn\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 11\u001b[0;31m \u001b[0mppOut\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mpc\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mGetReply\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mppIn\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mpylonpacket\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mPPSeriesNumber\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 12\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"Get series number reply:\"\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mppOut\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;31m#,ppOut.info.hex())\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 13\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", | ||
"\u001b[0;32m<ipython-input-26-3dc0e2e859e4>\u001b[0m in \u001b[0;36mGetReply\u001b[0;34m(self, request, reply_type)\u001b[0m\n\u001b[1;32m 27\u001b[0m \u001b[0;32mbreak\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 28\u001b[0m \u001b[0mlogging\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdebug\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"Received sentence %s\"\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mline\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 29\u001b[0;31m \u001b[0mpreply\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mpylonpacket\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mPylonPacket\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mParse\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mline\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mreply_type\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 30\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mpreply\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 31\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", | ||
"\u001b[0;32m~/gitclonetemp/PylonTechBattery/pylonpacket.py\u001b[0m in \u001b[0;36mParse\u001b[0;34m(ascii, packet_type)\u001b[0m\n\u001b[1;32m 102\u001b[0m \u001b[0;31m#logging.debug(\"Value to decode is %s\",ascii)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 103\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mascii\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m!=\u001b[0m \u001b[0;36m0x7E\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0mascii\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m-\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m!=\u001b[0m \u001b[0;36m0x0D\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 104\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mValueError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"Invalid packet format\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 105\u001b[0m \u001b[0mcontent\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mascii\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m-\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdecode\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 106\u001b[0m \u001b[0mlogging\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdebug\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"Content of packet: %s\"\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mcontent\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", | ||
"\u001b[0;31mValueError\u001b[0m: Invalid packet format" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"pc = PylonCom()\n", | ||
"\n", | ||
"ppIn = pylonpacket.PPGetSystemParameter()\n", | ||
"print(\"Get system parameter:\",ppIn)\n", | ||
"#ppOut = pc.GetReply(ppIn, pylonpacket.PPSystemParameter)\n", | ||
"#print(\"Get system parameter reply:\",ppOut)\n", | ||
"\n", | ||
"ppIn = pylonpacket.PPGetSeriesNumber()\n", | ||
"ppIn.Command = 0x02\n", | ||
"print(\"Get series number:\",ppIn)\n", | ||
"ppOut = pc.GetReply(ppIn, pylonpacket.PPSeriesNumber)\n", | ||
"print(\"Get series number reply:\",ppOut) #,ppOut.info.hex())\n", | ||
"\n", | ||
"for adr in range(2,3):\n", | ||
" print(\"Conectiong to addr\",adr)\n", | ||
" ppIn = pylonpacket.PPGetChargeManagementInformation()\n", | ||
" ppIn.Command = adr\n", | ||
" ppIn.ADR = adr\n", | ||
" #print(\"Get charge info:\",ppIn)\n", | ||
" ppOut = pc.GetReply(ppIn, pylonpacket.PPChargeManagementInformation)\n", | ||
" print(\"Get charge info reply:\",ppOut)\n", | ||
" \n", | ||
" #return\n", | ||
" ppIn = pylonpacket.PPGetAnalogValue()\n", | ||
" ppIn.Command = adr\n", | ||
" ppIn.ADR = adr\n", | ||
" #print(\"Get analog:\",ppIn)\n", | ||
" ppOut = pc.GetReply(ppIn, pylonpacket.PPAnalogValue)\n", | ||
" print(\"Get analog reply:\",ppOut)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 35, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"Get manufacturer info: VER: 0x20, ADR: 0x02, CID1: 0x46, CID2: 0x51, LENGTH: 0, len(INFO): 0, CHKSUM: 0x0000\n" | ||
] | ||
}, | ||
{ | ||
"ename": "ValueError", | ||
"evalue": "Invalid packet format", | ||
"output_type": "error", | ||
"traceback": [ | ||
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", | ||
"\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)", | ||
"\u001b[0;32m<ipython-input-35-380b5d3bf899>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0mppIn\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mpylonpacket\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mPPGetManufacturerInfo\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"Get manufacturer info:\"\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mppIn\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 5\u001b[0;31m \u001b[0mppOut\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mpc\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mGetReply\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mppIn\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mpylonpacket\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mPPManufacturerInfo\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 6\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"Get manufacturer info reply:\"\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mppOut\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", | ||
"\u001b[0;32m<ipython-input-26-3dc0e2e859e4>\u001b[0m in \u001b[0;36mGetReply\u001b[0;34m(self, request, reply_type)\u001b[0m\n\u001b[1;32m 27\u001b[0m \u001b[0;32mbreak\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 28\u001b[0m \u001b[0mlogging\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdebug\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"Received sentence %s\"\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mline\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 29\u001b[0;31m \u001b[0mpreply\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mpylonpacket\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mPylonPacket\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mParse\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mline\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mreply_type\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 30\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mpreply\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 31\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", | ||
"\u001b[0;32m~/gitclonetemp/PylonTechBattery/pylonpacket.py\u001b[0m in \u001b[0;36mParse\u001b[0;34m(ascii, packet_type)\u001b[0m\n\u001b[1;32m 102\u001b[0m \u001b[0;31m#logging.debug(\"Value to decode is %s\",ascii)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 103\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mascii\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m!=\u001b[0m \u001b[0;36m0x7E\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0mascii\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m-\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m!=\u001b[0m \u001b[0;36m0x0D\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 104\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mValueError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"Invalid packet format\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 105\u001b[0m \u001b[0mcontent\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mascii\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m-\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdecode\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 106\u001b[0m \u001b[0mlogging\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdebug\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"Content of packet: %s\"\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mcontent\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", | ||
"\u001b[0;31mValueError\u001b[0m: Invalid packet format" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"pc = PylonCom()\n", | ||
"\n", | ||
"ppIn=pylonpacket.PPGetManufacturerInfo()\n", | ||
"print(\"Get manufacturer info:\",ppIn)\n", | ||
"ppOut=pc.GetReply(ppIn, pylonpacket.PPManufacturerInfo)\n", | ||
"print(\"Get manufacturer info reply:\",ppOut)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 36, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"PORT = \"/dev/ttyUSB0\"\n", | ||
"BAUD = 115200\n", | ||
" \n", | ||
"sp = serial.Serial(PORT,BAUD,timeout=0.5)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 37, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"Serial<id=0xae6c0b2c, open=True>(port='/dev/ttyUSB0', baudrate=115200, bytesize=8, parity='N', stopbits=1, timeout=0.5, xonxoff=False, rtscts=False, dsrdtr=False)" | ||
] | ||
}, | ||
"execution_count": 37, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"sp\n" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"hide_input": false, | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.6.3" | ||
}, | ||
"toc": { | ||
"base_numbering": 1, | ||
"nav_menu": {}, | ||
"number_sections": true, | ||
"sideBar": true, | ||
"skip_h1_title": false, | ||
"title_cell": "Table of Contents", | ||
"title_sidebar": "Contents", | ||
"toc_cell": false, | ||
"toc_position": {}, | ||
"toc_section_display": true, | ||
"toc_window_display": false | ||
}, | ||
"varInspector": { | ||
"cols": { | ||
"lenName": 16, | ||
"lenType": 16, | ||
"lenVar": 40 | ||
}, | ||
"kernels_config": { | ||
"python": { | ||
"delete_cmd_postfix": "", | ||
"delete_cmd_prefix": "del ", | ||
"library": "var_list.py", | ||
"varRefreshCmd": "print(var_dic_list())" | ||
}, | ||
"r": { | ||
"delete_cmd_postfix": ") ", | ||
"delete_cmd_prefix": "rm(", | ||
"library": "var_list.r", | ||
"varRefreshCmd": "cat(var_dic_list()) " | ||
} | ||
}, | ||
"types_to_exclude": [ | ||
"module", | ||
"function", | ||
"builtin_function_or_method", | ||
"instance", | ||
"_Feature" | ||
], | ||
"window_display": false | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Seriepoorte in linux en python | ||
|
||
## Inleiding | ||
|
||
Die RS-232 is die ouer seriepoort formaat en RS-485 is die meer moderne formaat (kan langer kabels ondersteun en meer toestelle as een op dieselfde kabel). | ||
|
||
|
||
|
||
## Python serial | ||
|
||
Open 'n poort in python: | ||
|
||
Open port at “9600,8,N,1”, no timeout: | ||
|
||
```python | ||
>>> import serial | ||
>>> ser = serial.Serial('/dev/ttyUSB0') # open serial port | ||
>>> print(ser.name) # check which port was really used | ||
>>> ser.write(b'hello') # write a string | ||
>>> ser.close() # close port | ||
``` | ||
https://pythonhosted.org/pyserial/shortintro.html | ||
|
||
## How To Check and Use Serial Ports Under Linux | ||
|
||
Linux offers various tools. Linux uses ttySx for a serial port device name. For example, COM1 (DOS/Windows name) is ttyS0, COM2 is ttyS1 and so on. | ||
|
||
|
||
|
||
### Task: Display Detected System’s Serial Support | ||
|
||
Simply run dmesg command | ||
|
||
`$ dmesg | grep tty` | ||
|
||
```bash | ||
[ 37.531286] serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A | ||
[ 37.531841] 00:0b: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A | ||
[ 37.532138] 0000:04:00.3: ttyS1 at I/O 0x1020 (irq = 18) is a 16550A | ||
``` | ||
### 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]` | ||
|
||
Output: | ||
|
||
```bash | ||
/dev/ttyS0, UART: 16550A, Port: 0x03f8, IRQ: 4 | ||
/dev/ttyS1, UART: 16550A, Port: 0x1020, IRQ: 18 | ||
/dev/ttyS2, UART: unknown, Port: 0x03e8, IRQ: 4 | ||
/dev/ttyS3, UART: unknown, Port: 0x02e8, IRQ: 3 | ||
``` | ||
setserial with -g option help to find out what physical serial ports your Linux box has. |
Oops, something went wrong.