Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Eclipse SmartHome » serial driver in ESH?
serial driver in ESH? [message #1699022] Fri, 19 June 2015 15:09 Go to next message
Chris Jackson is currently offline Chris JacksonFriend
Messages: 256
Registered: December 2013
Senior Member
Kai,
I note that the serial bundle (org.openhav.io.transport.serial) is only in OH2 - not ESH. Can this be changed to ESH?

Chris
Re: serial driver in ESH? [message #1699024 is a reply to message #1699022] Fri, 19 June 2015 15:15 Go to previous messageGo to next message
Kai Kreuzer is currently offline Kai KreuzerFriend
Messages: 673
Registered: December 2011
Senior Member
No, because it is under the LGPL (see https://github.com/NeuronRobotics/nrjavaserial/issues/28) and this is not an accepted license for Eclipse projects - that's the reason why it stayed at OH2.

I was looking at introducing a transport.usb though, based on usb4java (https://github.com/usb4java/usb4java). This has very recently changed its license to MIT and it should actually be much nicer for ESH, since dongles could be directly discovered as bridges. I didn't try it out though, if practice meets the theory here - but if this is something that is interesting for you as well, feel free to have a go!

Regards,
Kai
Re: serial driver in ESH? [message #1699025 is a reply to message #1699024] Fri, 19 June 2015 15:22 Go to previous messageGo to next message
Chris Jackson is currently offline Chris JacksonFriend
Messages: 256
Registered: December 2013
Senior Member
Ok - I'm just moving a project over from OH2 that I originally started there, but is probably fine here (it's a new weather receiver for Davis stations) so I'll take a look at this as it does sound a lot nicer than the serial lib (if it works Smile )...
Re: serial driver in ESH? [message #1699052 is a reply to message #1699025] Fri, 19 June 2015 20:40 Go to previous messageGo to next message
Chris Jackson is currently offline Chris JacksonFriend
Messages: 256
Registered: December 2013
Senior Member
Unfortunately, this is not a simple replacement for the serial library - the USB lib only provides very low level functionality and really needs a middle layer library which is probably dependant on the chip being used, so it's really quite a problem Sad

I didn't realise RXTX was GPL Sad This could be a "small problem" for a few bindings that we might wanna make part of ESH...

Just for reference, I found an Android library which isn't directly compatible with javax-usb, but it looks similar, and it shows broadly what I think is needed for the middle layer (but it's also GPL!).
https://github.com/mik3y/usb-serial-for-android/tree/master/usbSerialForAndroid/src/main/java/com/hoho/android/usbserial/driver
Re: serial driver in ESH? [message #1701085 is a reply to message #1699052] Thu, 09 July 2015 08:57 Go to previous messageGo to next message
Kai Kreuzer is currently offline Kai KreuzerFriend
Messages: 673
Registered: December 2011
Senior Member
Quote:
the USB lib only provides very low level functionality and really needs a middle layer library which is probably dependant on the chip being used

Could you elaborate a bit on this? From examples like
https://github.com/usb4java/usb4java-examples/blob/master/src/main/java/org/usb4java/examples/SyncBulkTransfer.java, it seems to me as if you can simply read and write any kind of data, once you have a DeviceHandle. What "middle layer" functionality would you expect on top of this and why do you think that the code needs to be specific to the chip?
Re: serial driver in ESH? [message #1701126 is a reply to message #1701085] Thu, 09 July 2015 13:17 Go to previous messageGo to next message
Chris Jackson is currently offline Chris JacksonFriend
Messages: 256
Registered: December 2013
Senior Member
Yes, it can read and write data, but the problem is that this is a completely different way of operating than simply communicating via a serial port. Each serial chip (eg FTDI) works differently, so to send data, or set the DSR line, or whatever, you'd need to send different data to the USB port. This means that we're now having to write multiple drivers for each chip, and it's going to get really messy. So, to enable DSR on one serial chip you might send one set of data to the USB, but to do it on another chip, it's a different set...

Effectively usb4java gives you the tools to read and write to the USB port, but you still need to actually interface with the various chips on the other end...

Does that makes sense? At least that's my understanding from having searched around a bit and run up some simple tests. I couldn't find any decent sources for these 'drivers' - at least not with a friendly license.

Chris
Re: serial driver in ESH? [message #1701429 is a reply to message #1701126] Mon, 13 July 2015 12:15 Go to previous messageGo to next message
Kai Kreuzer is currently offline Kai KreuzerFriend
Messages: 673
Registered: December 2011
Senior Member
Ok, thanks for the explanations, I think I get your point.
So when using rxtx with an RS232-USB-cable, it is actually the linux driver that already exists supports certain chips like FTDI and does all the low-level handshake for us (like this stuff: https://www.silabs.com/Support%20Documents/TechnicalDocs/an197.pdf), so that on the rxtx API we do not notice anything. But this also means that the underlying Linux needs to have the driver built into it, right? How many different chips are supported by a normal Linux distro? Do you have any idea? If we could cover 95% with 2-3 chips, it might be worth the effort to go into it, otherwise I would agree to refrain from that.
Re: serial driver in ESH? [message #1701520 is a reply to message #1701429] Mon, 13 July 2015 20:14 Go to previous messageGo to next message
Chris Jackson is currently offline Chris JacksonFriend
Messages: 256
Registered: December 2013
Senior Member
I think there's 3 main chips from what I could tell, but it wasn't exactly an extensive search. I believe that if you go through the lower level USB calls then the drivers aren't required - this is probably quite nice as it would also negate the need to install these drivers...

I agree it would be nice to have this, but I suspect it might be a bit of work to implement unfortunately...
Re: serial driver in ESH? [message #1701667 is a reply to message #1701520] Tue, 14 July 2015 19:32 Go to previous message
Kai Kreuzer is currently offline Kai KreuzerFriend
Messages: 673
Registered: December 2011
Senior Member
Ok, nothing of a high prio for the moment, I guess.

So back to your original question about io.transport.serial: An option we might have is to adopt javax.comm packages as an interface to work against for serial access. in ESH we could then offer dkcomm as one implementation, but keep RXTX within openHAB 2.
The Kura project does it this way, see this discussion: https://dev.eclipse.org/mhonarc/lists/iot-wg/msg00369.html
Previous Topic:State conversion in channels
Next Topic:Which web server is used for openHAB2?
Goto Forum:
  


Current Time: Fri Apr 26 19:08:22 GMT 2024

Powered by FUDForum. Page generated in 0.03608 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top