Question abt FdWatch

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Question abt FdWatch

Adi Bier-3
Hi Tobias,

I'm currently working on the pseudo-tty extension using FdWatch. A
possible way would be:

1) create the slave device by accessing /dev/ptmx

int master=posix_openpt(O_RDWR);

2) create a symlink from /dev/pts/X to e.g. /tmp/dtmf

symlink(slave, serial_port.c_str())

Now we have a symlink /dev/pts/X -> /tmp/dtmf

3) accessing /dev/pts/X by FdWatch to register incoming characters from
/tmp/dtmf:

   int fd = open(slave, O_RDONLY))
   watch = new FdWatch(fd, FdWatch::FD_WATCH_RD);
   assert(watch != 0);
   watch->setEnabled(true);
   watch->activity.connect(mem_fun(*this,
&PtyDtmfDecoder::charactersReceived));

My problem is that the watcher function doesn't register incoming
characters sent by a script to /tmp/dtmf so I guess that symlinks aren't
supported at the moment by FdWatch? FdWatch with STDIN is used in the
project and working well.

Thank's for a hint.

vy 73's de Adi, DL1HRC


------------------------------------------------------------------------------
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform
_______________________________________________
Svxlink-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/svxlink-devel
Reply | Threaded
Open this post in threaded view
|

Re: Question abt FdWatch

Rob Janssen
Adi Bier wrote:
> My problem is that the watcher function doesn't register incoming
> characters sent by a script to /tmp/dtmf so I guess that symlinks aren't
> supported at the moment by FdWatch? FdWatch with STDIN is used in the
> project and working well.
>
> Thank's for a hint.
>

Did you configure the pty to actually return data in the format that you use?
(termios settings that return either single charcters, use a timeout, or whatever)
By default the pty will likely be in line mode and will not pass individual characters.

Rob

------------------------------------------------------------------------------
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform
_______________________________________________
Svxlink-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/svxlink-devel
Reply | Threaded
Open this post in threaded view
|

Re: Question abt FdWatch

Adi Bier-3
Am 25.04.2014 10:44, schrieb Rob Janssen:

> Adi Bier wrote:
>> My problem is that the watcher function doesn't register incoming
>> characters sent by a script to /tmp/dtmf so I guess that symlinks aren't
>> supported at the moment by FdWatch? FdWatch with STDIN is used in the
>> project and working well.
>>
>> Thank's for a hint.
>>
>
> Did you configure the pty to actually return data in the format that you use?
> (termios settings that return either single charcters, use a timeout, or whatever)
> By default the pty will likely be in line mode and will not pass individual characters.
>
> Rob

Hi Rob

thank you for this info, I think I have to play a bit with ioctl.

73's de Adi, DL1HRC

------------------------------------------------------------------------------
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform
_______________________________________________
Svxlink-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/svxlink-devel
Reply | Threaded
Open this post in threaded view
|

Re: Question abt FdWatch

Tobias Blomberg
On Friday 25 April 2014 20:05:10 Adi Bier wrote:

> Am 25.04.2014 10:44, schrieb Rob Janssen:
> > Adi Bier wrote:
> >> My problem is that the watcher function doesn't register incoming
> >> characters sent by a script to /tmp/dtmf so I guess that symlinks aren't
> >> supported at the moment by FdWatch? FdWatch with STDIN is used in the
> >> project and working well.
> >>
> >> Thank's for a hint.
> >
> > Did you configure the pty to actually return data in the format that you
> > use? (termios settings that return either single charcters, use a
> > timeout, or whatever) By default the pty will likely be in line mode and
> > will not pass individual characters.
> >
> > Rob
>
> Hi Rob
>
> thank you for this info, I think I have to play a bit with ioctl.

If I understand your email correctly, the problem is rather that you are
trying to use the slave device from svxlink. That should be opened by the
external script. The master end of the PTY should be used inside of svxlink.
To create a new PTY:

  int master_fd = posix_openpt(O_RDONLY|O_NOCTTY);
  grantpt(master_fd);
  unlockpt(master_fd);

Watch that:

  FdWatch *watch = new FdWatch(master_fd, FdWatch::FD_WATCH_RD);
  watch->activity.connect(...);

Create symlink:

  char *slave = ptsname(master_fd);
  symlink(slave, "/tmp/dtmf");

Now you should be able to open the slave device using /tmp/dtmf from the
script and write chars to it.

73's de SM0SVX / Tobias


>
> 73's de Adi, DL1HRC


------------------------------------------------------------------------------
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform
_______________________________________________
Svxlink-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/svxlink-devel
Reply | Threaded
Open this post in threaded view
|

Re: Question abt FdWatch

Adi Bier-3
Hi Tobias,

I've created a branch for the FdWatch extension. I've changed the source
code according to the hints but here (Ubuntu 11.x) it has still the same
effect (no registration of incoming characters).
So I hope if we looking together on it we will find a way to make it
working.

vy 73's de Adi, DL1HRC


Am 26.04.2014 15:24, schrieb SM0SVX:

> On Friday 25 April 2014 20:05:10 Adi Bier wrote:
>> Am 25.04.2014 10:44, schrieb Rob Janssen:
>>> Adi Bier wrote:
>>>> My problem is that the watcher function doesn't register incoming
>>>> characters sent by a script to /tmp/dtmf so I guess that symlinks aren't
>>>> supported at the moment by FdWatch? FdWatch with STDIN is used in the
>>>> project and working well.
>>>>
>>>> Thank's for a hint.
>>> Did you configure the pty to actually return data in the format that you
>>> use? (termios settings that return either single charcters, use a
>>> timeout, or whatever) By default the pty will likely be in line mode and
>>> will not pass individual characters.
>>>
>>> Rob
>> Hi Rob
>>
>> thank you for this info, I think I have to play a bit with ioctl.
> If I understand your email correctly, the problem is rather that you are
> trying to use the slave device from svxlink. That should be opened by the
> external script. The master end of the PTY should be used inside of svxlink.
> To create a new PTY:
>
>    int master_fd = posix_openpt(O_RDONLY|O_NOCTTY);
>    grantpt(master_fd);
>    unlockpt(master_fd);
>
> Watch that:
>
>    FdWatch *watch = new FdWatch(master_fd, FdWatch::FD_WATCH_RD);
>    watch->activity.connect(...);
>
> Create symlink:
>
>    char *slave = ptsname(master_fd);
>    symlink(slave, "/tmp/dtmf");
>
> Now you should be able to open the slave device using /tmp/dtmf from the
> script and write chars to it.
>
> 73's de SM0SVX / Tobias
>
>
>> 73's de Adi, DL1HRC
>
> ------------------------------------------------------------------------------
> Start Your Social Network Today - Download eXo Platform
> Build your Enterprise Intranet with eXo Platform Software
> Java Based Open Source Intranet - Social, Extensible, Cloud Ready
> Get Started Now And Turn Your Intranet Into A Collaboration Platform
> http://p.sf.net/sfu/ExoPlatform
> _______________________________________________
> Svxlink-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/svxlink-devel


------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.  Get
unparalleled scalability from the best Selenium testing platform available.
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Svxlink-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/svxlink-devel
Reply | Threaded
Open this post in threaded view
|

Re: Question abt FdWatch

Tobias Blomberg
On Wednesday 30 April 2014 08:11:59 Adi Bier wrote:
> Hi Tobias,
>
> I've created a branch for the FdWatch extension. I've changed the source
> code according to the hints but here (Ubuntu 11.x) it has still the same
> effect (no registration of incoming characters).
> So I hope if we looking together on it we will find a way to make it
> working.

Please look at my example again. You are still watching the slave fd instead
of the master fd. You should not open the slave fd in SvxLink. That's the
other end of the PTY which the external handling script should open to inject
detected DTMF digits.

You are also calling grantpt and unlockpt twice. I don't know if that can
cause any harm but it's unnecessary anyway.

73's de SM0SVX / Tobias


>
> vy 73's de Adi, DL1HRC
>
> Am 26.04.2014 15:24, schrieb SM0SVX:
> > On Friday 25 April 2014 20:05:10 Adi Bier wrote:
> >> Am 25.04.2014 10:44, schrieb Rob Janssen:
> >>> Adi Bier wrote:
> >>>> My problem is that the watcher function doesn't register incoming
> >>>> characters sent by a script to /tmp/dtmf so I guess that symlinks
> >>>> aren't
> >>>> supported at the moment by FdWatch? FdWatch with STDIN is used in the
> >>>> project and working well.
> >>>>
> >>>> Thank's for a hint.
> >>>
> >>> Did you configure the pty to actually return data in the format that you
> >>> use? (termios settings that return either single charcters, use a
> >>> timeout, or whatever) By default the pty will likely be in line mode and
> >>> will not pass individual characters.
> >>>
> >>> Rob
> >>
> >> Hi Rob
> >>
> >> thank you for this info, I think I have to play a bit with ioctl.
> >
> > If I understand your email correctly, the problem is rather that you are
> > trying to use the slave device from svxlink. That should be opened by the
> > external script. The master end of the PTY should be used inside of
> > svxlink.>
> > To create a new PTY:
> >    int master_fd = posix_openpt(O_RDONLY|O_NOCTTY);
> >    grantpt(master_fd);
> >    unlockpt(master_fd);
> >
> > Watch that:
> >    FdWatch *watch = new FdWatch(master_fd, FdWatch::FD_WATCH_RD);
> >    watch->activity.connect(...);
> >
> > Create symlink:
> >    char *slave = ptsname(master_fd);
> >    symlink(slave, "/tmp/dtmf");
> >
> > Now you should be able to open the slave device using /tmp/dtmf from the
> > script and write chars to it.
> >
> > 73's de SM0SVX / Tobias
> >
> >> 73's de Adi, DL1HRC


------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.  Get
unparalleled scalability from the best Selenium testing platform available.
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Svxlink-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/svxlink-devel
Reply | Threaded
Open this post in threaded view
|

Re: Question abt FdWatch

Adi Bier-3
Am 30.04.2014 08:30, schrieb SM0SVX:

> On Wednesday 30 April 2014 08:11:59 Adi Bier wrote:
>> Hi Tobias,
>>
>> I've created a branch for the FdWatch extension. I've changed the source
>> code according to the hints but here (Ubuntu 11.x) it has still the same
>> effect (no registration of incoming characters).
>> So I hope if we looking together on it we will find a way to make it
>> working.
> Please look at my example again. You are still watching the slave fd instead
> of the master fd. You should not open the slave fd in SvxLink. That's the
> other end of the PTY which the external handling script should open to inject
> detected DTMF digits.
>
> You are also calling grantpt and unlockpt twice. I don't know if that can
> cause any harm but it's unnecessary anyway.

Hi Tobias,

thank you, your're right. It's now working with the changes in branch.

vy 73's de Adi, DL1HRC

> 73's de SM0SVX / Tobias
>
>
>> vy 73's de Adi, DL1HRC
>>
>> Am 26.04.2014 15:24, schrieb SM0SVX:
>>> On Friday 25 April 2014 20:05:10 Adi Bier wrote:
>>>> Am 25.04.2014 10:44, schrieb Rob Janssen:
>>>>> Adi Bier wrote:
>>>>>> My problem is that the watcher function doesn't register incoming
>>>>>> characters sent by a script to /tmp/dtmf so I guess that symlinks
>>>>>> aren't
>>>>>> supported at the moment by FdWatch? FdWatch with STDIN is used in the
>>>>>> project and working well.
>>>>>>
>>>>>> Thank's for a hint.
>>>>> Did you configure the pty to actually return data in the format that you
>>>>> use? (termios settings that return either single charcters, use a
>>>>> timeout, or whatever) By default the pty will likely be in line mode and
>>>>> will not pass individual characters.
>>>>>
>>>>> Rob
>>>> Hi Rob
>>>>
>>>> thank you for this info, I think I have to play a bit with ioctl.
>>> If I understand your email correctly, the problem is rather that you are
>>> trying to use the slave device from svxlink. That should be opened by the
>>> external script. The master end of the PTY should be used inside of
>>> svxlink.>
>>> To create a new PTY:
>>>     int master_fd = posix_openpt(O_RDONLY|O_NOCTTY);
>>>     grantpt(master_fd);
>>>     unlockpt(master_fd);
>>>
>>> Watch that:
>>>     FdWatch *watch = new FdWatch(master_fd, FdWatch::FD_WATCH_RD);
>>>     watch->activity.connect(...);
>>>
>>> Create symlink:
>>>     char *slave = ptsname(master_fd);
>>>     symlink(slave, "/tmp/dtmf");
>>>
>>> Now you should be able to open the slave device using /tmp/dtmf from the
>>> script and write chars to it.
>>>
>>> 73's de SM0SVX / Tobias
>>>
>>>> 73's de Adi, DL1HRC
>
> ------------------------------------------------------------------------------
> "Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
> Instantly run your Selenium tests across 300+ browser/OS combos.  Get
> unparalleled scalability from the best Selenium testing platform available.
> Simple to use. Nothing to install. Get started now for free."
> http://p.sf.net/sfu/SauceLabs
> _______________________________________________
> Svxlink-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/svxlink-devel


------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.  Get
unparalleled scalability from the best Selenium testing platform available.
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Svxlink-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/svxlink-devel