RPC client on linux (posix)

classic Classic list List threaded Threaded
5 messages Options
Matt Wilbur Matt Wilbur
Reply | Threaded
Open this post in threaded view
|

RPC client on linux (posix)

I ran into a little snag that took a few years off my life yesterday (until I fixed it, at which time I got those years back - mostly) because I'm planning to rely pretty heavily on RPC.

I'd be curious to see if anyone can repeat it.  

In luarpc do something like this

slv = rpc.connect( your serial device here )

slv.data = { [13] = 1 }
data = slv.data:get()
=data[13]

I found that the setup of the serial port on my linux machine was very politely translating that 13 to 10 (\r -> \n), so data[13] was nil and data[10] was 1.

I had to add a ICRNL to the c_iflag (this by judicious googling) in serial_posix.c

At any rate, I can create a pull request if needed, or someone else could add it (though I'd be tickled to have a contribution to the project).

Matt

_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
Thiago Naves Thiago Naves
Reply | Threaded
Open this post in threaded view
|

Re: RPC client on linux (posix)

Nice one.
Quite a subtle bug!

I just tryed this on mac os and it works as expected ( i.e. =data[13] returns 1 ).

I then added the ICRNL and it works the same.

Do a pull request. ;)

--
Thiago


On Wed, Mar 21, 2012 at 9:43 AM, Matt Wilbur <[hidden email]> wrote:
I ran into a little snag that took a few years off my life yesterday (until I fixed it, at which time I got those years back - mostly) because I'm planning to rely pretty heavily on RPC.

I'd be curious to see if anyone can repeat it.  

In luarpc do something like this

slv = rpc.connect( your serial device here )

slv.data = { [13] = 1 }
data = slv.data:get()
=data[13]

I found that the setup of the serial port on my linux machine was very politely translating that 13 to 10 (\r -> \n), so data[13] was nil and data[10] was 1.

I had to add a ICRNL to the c_iflag (this by judicious googling) in serial_posix.c

At any rate, I can create a pull request if needed, or someone else could add it (though I'd be tickled to have a contribution to the project).

Matt

_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev


_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
Markus Korber Markus Korber
Reply | Threaded
Open this post in threaded view
|

Re: RPC client on linux (posix)

In reply to this post by Matt Wilbur
Thus spake Matt Wilbur:

> I found that the setup of the serial port on my linux machine was very
> politely translating that 13 to 10 (\r -> \n), so data[13] was nil and
> data[10] was 1.
>
> I had to add a ICRNL to the c_iflag (this by judicious googling) in
> serial_posix.c

Are you using the master branch since this should already be fixed there?
https://github.com/elua/elua/commit/e823c8d3fcedf6908bfc5a1e92f9139849667355

Regards,
Markus Korber
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
Matt Wilbur Matt Wilbur
Reply | Threaded
Open this post in threaded view
|

Re: RPC client on linux (posix)


On Thursday, 22 March, 2012 at 2:20 AM, Markus Korber wrote:

Thus spake Matt Wilbur:

I found that the setup of the serial port on my linux machine was very
politely translating that 13 to 10 (\r -> \n), so data[13] was nil and
data[10] was 1.

I had to add a ICRNL to the c_iflag (this by judicious googling) in
serial_posix.c

Are you using the master branch since this should already be fixed there?

I have updated to the head of the mater branch.

The commit you point to is for the RFS server.  I'm looking at the RPC client code.  Perhaps there is duplication here that should be eliminated.

Matt

_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
Thiago Naves Thiago Naves
Reply | Threaded
Open this post in threaded view
|

Re: RPC client on linux (posix)

Merged.

--
Thiago


On Thu, Mar 22, 2012 at 8:35 AM, Matt Wilbur <[hidden email]> wrote:

On Thursday, 22 March, 2012 at 2:20 AM, Markus Korber wrote:

Thus spake Matt Wilbur:

I found that the setup of the serial port on my linux machine was very
politely translating that 13 to 10 (\r -> \n), so data[13] was nil and
data[10] was 1.

I had to add a ICRNL to the c_iflag (this by judicious googling) in
serial_posix.c

Are you using the master branch since this should already be fixed there?
https://github.com/elua/elua/commit/e823c8d3fcedf6908bfc5a1e92f9139849667355<span onmouseout="cancel = false; window.setTimeout(WRCHideContent, 1000); clearTimeout(showTimer);" onmouseover=" var self = this; showTimer = window.setTimeout(function(){WRCShowContent({&#39;rating&#39;:{&#39;value&#39;:95,&#39;weight&#39;:72},&#39;flags&#39;:{&#39;it&#39;:1},&#39;single&#39;:true,&#39;ttl&#39;:7200,&#39;expireTime&#39;:&#39;20120306183119&#39;}, self.className)},600);" class="wrc13" style="padding-right:16px;width:16px;height:16px">

I have updated to the head of the mater branch.

The commit you point to is for the RFS server.  I'm looking at the RPC client code.  Perhaps there is duplication here that should be eliminated.

Matt

_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev<span onmouseout="cancel = false; window.setTimeout(WRCHideContent, 1000); clearTimeout(showTimer);" onmouseover=" var self = this; showTimer = window.setTimeout(function(){WRCShowContent({&#39;rating&#39;:{&#39;value&#39;:100,&#39;weight&#39;:13},&#39;flags&#39;:{},&#39;single&#39;:false,&#39;ttl&#39;:7200,&#39;expireTime&#39;:&#39;20120308202140&#39;}, self.className)},600);" class="wrc11" style="padding-right:16px;width:16px;height:16px">


_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev