Skip to content

add uv_device_t as stream on windows and Linux to handle device IO#379

Closed
zhaozg wants to merge 0 commit into
libuv:v1.xfrom
zhaozg:v1.x
Closed

add uv_device_t as stream on windows and Linux to handle device IO#379
zhaozg wants to merge 0 commit into
libuv:v1.xfrom
zhaozg:v1.x

Conversation

@zhaozg

@zhaozg zhaozg commented May 30, 2015

Copy link
Copy Markdown
Contributor

No description provided.

@zhaozg zhaozg force-pushed the v1.x branch 2 times, most recently from 9960e59 to ca0ef54 Compare June 2, 2015 13:35
@fivdi

fivdi commented Jun 17, 2015

Copy link
Copy Markdown

Will there be node bindings for calling the new functions like uv_device_ioctl?

@saghul

saghul commented Jun 17, 2015

Copy link
Copy Markdown
Member

Will there be node bindings for calling the new functions like uv_device_ioctl?

That's up to Node, this is libuv.

@trevnorris

Copy link
Copy Markdown
Member

Mind adding something to docs/? :)

@creationix

Copy link
Copy Markdown
Contributor

Sorry for showing my ignorance, but is rs232 the kind of serial protocol used to talk to things like arduinos?

Also for what it's worth, chrome apps have had s serial API for some time that's used by various apps to talk to hardware devices. https://developer.chrome.com/apps/serial. I mention this because it's a cross-platform API that could help guide what features libuv wants to tacke. We obviously don't need all the annoying security sandbox features and can keep our existing stream APIs though.

@saghul

saghul commented Aug 7, 2015

Copy link
Copy Markdown
Member

@creationix Thanks for the link, I'll take a look. Hopefully now that 1.7 is out I can review this thorougly soon.

Currently this patch only exposes the minimum components for device communication: opening, reading, writing and a generic ioctl mechanism, applications would use platform specific ioctls to change parameters such as baud rate. Note that this can also be used to open devices such as /dev/tun.

@creationix

Copy link
Copy Markdown
Contributor

Right, I see use in both a low-level system interface that require users to write platform specific code and a cross-platform high-level serial interface that is less capable, but works cross-platform for a specific use case.

I've gone down this road before with luvit and the problem with just exposing ioctl when pairing libuv with a scripting language is that the scripting language doesn't have access to system headers (macros and constants) to know which ioctls to use.

@creationix

Copy link
Copy Markdown
Contributor

Maybe the burden of the cross-platform ioctl part should live between libuv and the scripting language (luvi in my case). Libuv would provide the minimal bits to call ioctls on uv device streams and the C code using it would be responsible for the rest. But the API exposed to the scripting language would look more like the chrome.serial API.

@saghul

saghul commented Aug 7, 2015

Copy link
Copy Markdown
Member

Maybe the burden of the cross-platform ioctl part should live between libuv and the scripting language (luvi in my case). Libuv would provide the minimal bits to call ioctls on uv device streams and the C code using it would be responsible for the rest. But the API exposed to the scripting language would look more like the chrome.serial API.

This sounds like a good idea to me!

@creationix

Copy link
Copy Markdown
Contributor

It would be really cool if there was a collection of libuv addons that handled this in a generic way independent of the vm being used. Then node, pyuv and luvit can share the serial module that lives between libuv and the vm.

@zhaozg

zhaozg commented Aug 18, 2015

Copy link
Copy Markdown
Contributor Author

sorry for close this, because I need to keep step with v1.x, so I create a branch for device at https://github.com/zhaozg/libuv/tree/device

@dtex

dtex commented Aug 18, 2015

Copy link
Copy Markdown

Now #484

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants