Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serial connection only over relay (socat) #5

Open
PickManInTheMiddle opened this issue Dec 16, 2018 · 2 comments
Open

Serial connection only over relay (socat) #5

PickManInTheMiddle opened this issue Dec 16, 2018 · 2 comments

Comments

@PickManInTheMiddle
Copy link

PickManInTheMiddle commented Dec 16, 2018

A JeeLink is connected to /dev/ttyUSB0.

Everything described below is executed with a user has full access to /dev/ttyUSB0:

When I try to scan the sensors using the following command, there is no response from pylacrosse:
pylacrosse -r 1 -d /dev/ttyUSB0 scan

To monitor the behavior, I created a relay with socat:
socat /dev/ttyUSB0,raw,echo=0 SYSTEM:'tee in.txt |socat - "PTY,link=/tmp/ttyUSB0,raw,echo=0,waitslave" |tee out.txt'

Started pylacrosse again using the relay:

pylacrosse -r 1  -d /tmp/ttyUSB0 scan
id=16 t=-0.100000 h=85 nbat=0 name=unknown
id=32 t=0.700000 h=83 nbat=0 name=unknown

Strangely now pylacrosse is displaying my sensors...

Terminal programs (tested with picoterm and here with pythons minicom) are also working:

python -m serial.tools.miniterm /dev/ttyUSB0 57600
--- Miniterm on /dev/ttyUSB0  57600,8,N,1 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
␀

[LaCrosseITPlusReader.10.1s (RFM69CW f:868300 r:17241)]
1r
v

[LaCrosseITPlusReader.10.1s (RFM69CW f:868300 r:9579)]
OK 9 43 1 4 116 53
OK 9 16 1 3 231 85

--- exit ---

Info:The commands "1r" and "v" were not echoed and added manually.

The info-command also works with pylacrosse (for /dev/ttyUSB0 and /tmp/ttyUSB0):

pylacrosse -d /dev/ttyUSB0 info
name:     LaCrosseITPlusReader
version:  10.1s
rfm1name: RFM69CW
rfm1frequency: 868300
rfm1datarate: 17241
rfm1toggleinterval: None
rfm1togglemask: None

Used versions:

  • pylacrosse: 0.3.1 (as shown in version.py)
  • python: 3.7.1
@hthiery
Copy link
Owner

hthiery commented Dec 18, 2018

This is really strange. I added my "standard" users to the plugdev group (ttyUSB is automatically added by to this by debian) to have access to the device.

@PickManInTheMiddle
Copy link
Author

Yes, stange indeed.

I was also able to reproduce the problem on a windows host.

My "solution" for this problem was, that I compliled the JeeLink firmware with a default datarate of 9579.

LaCrosseITPlusReader10.ino (line 47):
unsigned long DATA_RATE_R1 = 9579ul;

Now, pylacrosse starts with the right datarate and no commands are needed.

I seems that not command reaches the JeeLink.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants