Symbolic Link Between USB and COM Port
Normally you have a pre-existing device node called ttyS0 on your system. For example, I have:
[romano:/dev] % ls -l /dev/ttyS0
crw-rw---- 1 root dialout 4, 64 oct 14 17:12 /dev/ttyS0
Giving the timestamp, the device is probably created by the udev
daemon at boot.
If you do not have a real serial port / modem connected or you do not want to use it, nobody stops you from removing the device node:
rm /dev/ttyS0
(add the necessary sudo
s around). After that, you can symlink /dev/ttyUSB0
to it.
I think the node will be recreated at next boot; otherwise you can regenerate it (after deleting the symlink) with:
[romano:/dev] % sudo mknod /dev/ttyS0 c 4 64
[romano:/dev] % sudo chown root.dialout /dev/ttyS0
[romano:/dev] % sudo chmod 660 /dev/ttyS0
[romano:/dev] % ls -l /dev/ttyS0
crw-rw---- 1 root dialout 4, 64 oct 15 22:19 /dev/ttyS0
Related videos on Youtube
Chubaka
Updated on September 18, 2022Comments
-
Chubaka almost 2 years
In python 3.7 and pandas 1.3.0
If there is a dataframe df with columns a,b,c
df=pd.DataFrame( [ {'a':'1'}, {'b':''}, {'c':'3'} ])
Trying to combine the column a, b, c into a new column abc using
df['abc'] = df.a.astype(str) + ' ' + df.b.astype( str) + ' ' + df.c.astype(str)
This will make the columns like
>>> df['abc'] 0 1 nan nan 1 nan nan 2 nan nan 3
Is there anyway I can combine these 3 columns into one, while don't return any value if the column is empty? Something like this:
>>> df['abc'] 0 1 1 2 3
Thank you!
-
Byte Commander over 8 yearsYou can't overwrite an existing (maybe virtual?) COM port (
ttyS0
). Try other numbers in increasing order until you find the first free name, e.g./dev/ttyS1
. I think that should help. If it does, tell me and I'll convert this to an answer, if not, also tell me and I'll try to think of something else.
-
-
Robert S. Barnes over 8 yearsUbuntu seems to automatically create ttyS0 up to ttyS31 on every boot. I deleted tty2 and created the link, but when I start the program under wine it doesn't see any com ports.
-
Rmano over 8 yearsBe careful,
tty2
andttyS2
are different beasts (the latter should be COM3) -
Byte Commander over 8 years@RobertS.Barnes That is a different problem (if it's not only a typo in your comment, mixing up
tty2
andttyS2
). Please open a second question about making/dev/ttyS*
COM ports visible to Wine applications. You should also accept this answer, as it solves the problem you first described. Maybe you want to edit your question after having written the second one to add a link to it though. -
Robert S. Barnes over 8 yearsThat's just a typo. Having to manually recreate the link on every boot doesn't seem like a viable option. Instead see the edit to my original question for what seems to be a viable solution. Also See here for the new question: askubuntu.com/questions/686019/…