LinuxMCE Forums

General => Developers => Topic started by: wooly on January 28, 2013, 11:28:15 pm

Title: (NOW WORKING) 'DS9490R 1wire usb adapter' working!
Post by: wooly on January 28, 2013, 11:28:15 pm
Problem with the DS9490R with LMCE.  Take a look at:

http://forum.linuxmce.org/index.php/topic,11328.150.html (http://forum.linuxmce.org/index.php/topic,11328.150.html)

And my chat with Techstyle: http://forum.linuxmce.org/index.php/topic,13040.msg94271.html#msg94271 (http://forum.linuxmce.org/index.php/topic,13040.msg94271.html#msg94271)

I know RULE#1......12 months+?
Should I just bin it in parts bin and buy something else? ???

Regards
Wooly
Title: Re: Magic Fingers wanted to get 'DS9490R 1wire usb adapter' working!
Post by: tschak909 on January 29, 2013, 03:55:21 pm
I do not have a 1-wire setup here, however, if somebody would send me a 9490R, and a couple of sensors, I could do the necessary work to debug the implementation.

-Thom
Title: Re: Magic Fingers wanted to get 'DS9490R 1wire usb adapter' working!
Post by: mkbrown69 on January 29, 2013, 10:40:03 pm
Thom,

Actually, if you're able to make the C++ 1-wire device template more flexible, to accommodate more of the OWFS supported devices, that may solve the problem.  Right now it's hard-coded to expect a serial type device, which rules out all the network, i2c, and other types of OWFS bus masters <http://owfs.org/index.php?page=bus-masters>

In my case, I'd like to be able to use my Raspberry Pi as a networked OWFS control node.  I have some quick and dirty bash scripts running that do owreads into a variable, and then do a messagesend to a manually created device on the core.  Works well enough for proof-of-concept, and I can see the little Thermometer icon on the floor plans.

Just a thought...

Thanks!

/Mike
Title: Re: Magic Fingers wanted to get 'DS9490R 1wire usb adapter' working!
Post by: hari on January 30, 2013, 10:04:55 am
Adding other adapter types is straightforward. The OneWire DCE device uses the OWCAPI (the C API from the OWFS project). The initialisation is done with the ow_init() call described here: http://owfs.org/uploads/owcapi.1.html#sect8
As you can see it takes the same device options as owfs(5), so besides serial devices it is also possible to specify a tcp connection to an owserver instance or usb devices (e.g. "usb"). ow_init() is called here: http://svn.linuxmce.org/trac.cgi/browser/branches/LinuxMCE-1004/src/OneWire/OneWire.cpp#L78
Code: [Select]
72         string port = TranslateSerialUSB(DATA_Get_COM_Port_on_PC());
[…]
78         if (OW_init(port.c_str())==0) {
[…]
the "port" string would need to be assigned with other owfs device options to achieve the wanted behaviour. So one could probably add a device parameter for a specific owfs init string. If that is set it would take precedence over COM_Port_on_PC.

A quick hack in the database to test if I'm right could look like this:
update Device_DeviceData set IK_DeviceData='usb'  where FK_DeviceData=37 and FK_Device=<id of your OneWire device>;
Title: Re: Magic Fingers wanted to get 'DS9490R 1wire usb adapter' working!
Post by: hari on January 30, 2013, 10:08:29 am
Another option would be to just set the port string to "usb" when the DATA_Get_COM_Port_on_PC() is empty (because no serial port was set in the web admin):

Code: [Select]
72         string port = TranslateSerialUSB(DATA_Get_COM_Port_on_PC());
73             if (port == "") port = "usb";

That would not allow people to use tcp or other connection methods, but it would at least fail back to USB when no serial port is set..
Title: Re: Magic Fingers wanted to get 'DS9490R 1wire usb adapter' working!
Post by: hari on January 30, 2013, 10:50:16 am
this is untested but could work: http://svn.linuxmce.org/trac.cgi/changeset/27136
Title: Re: Magic Fingers wanted to get 'DS9490R 1wire usb adapter' working!
Post by: wooly on January 30, 2013, 12:11:38 pm
Hari,
How do I test/get this? sqlCVS update and or apt-get update?
Sorry newbie question's :D
Also I may have broke the 1wire template 2161, By making changes to device data section!
Is there a way to get it back to original?

Many thanks for your help

Wooly

Title: Re: Magic Fingers wanted to get 'DS9490R 1wire usb adapter' working!
Post by: hari on January 30, 2013, 01:50:52 pm
you can revert the local changes in the sqlcvs section of the web admin
Title: Re: Magic Fingers wanted to get 'DS9490R 1wire usb adapter' working!
Post by: wooly on January 30, 2013, 09:38:12 pm
I can now report success ;D (adapter registered)
THANK YOU Hari
I did need to make changes to my device template 2161 though to get it to work:
Comm Method was saying 'RS232' so changed to 'Please select'
Under Device data - 37 com port on pc (string) - Default value - was still saying 'dev/ttyS0' so just deleted value and saved template then reload.....Thats it, it just worked ;D

Sorry Thom was nearly ready to put DS9490R in post to you!

Wish I could code, tried programing a pic chip once in C+ gave up after 2weeks & used pic basic instead took 1day.

Respect,

Wooly
Title: Re: Magic Fingers wanted to get 'DS9490R 1wire usb adapter' working!
Post by: Marie.O on January 31, 2013, 06:41:46 am
wooly,

why don't you put that DS9490R into the post to TSCHAK as a thank you for his work anyhow? Or visit http://www.linuxmce.org, and donate...

Just a thought
Title: Re: Magic Fingers wanted to get 'DS9490R 1wire usb adapter' working!
Post by: wooly on January 31, 2013, 08:39:55 pm
posde,

Was thinking I would make a donation as I don't have to buy a new 1wire adapter, although I am destitute at the moment that may change in the next few weeks, so watch this space...

As far as I know it was Hari that fixed 1wire....Thom just offered to if he got a DS9490R, so please read full topic thread.

Respect to all dev team.

Wooly
Title: Re: Magic Fingers wanted to get 'DS9490R 1wire usb adapter' working!
Post by: Marie.O on January 31, 2013, 09:05:10 pm
I read the whole thread. hari and tschak both deserve as much "Thank you"s as you can offer. Without them, there would be no LinuxMCE.
Title: Re: Magic Fingers wanted to get 'DS9490R 1wire usb adapter' working!
Post by: hari on January 31, 2013, 10:21:00 pm
he said thank you :-)
Title: Re: Magic Fingers wanted to get 'DS9490R 1wire usb adapter' working!
Post by: Techstyle on February 01, 2013, 04:22:03 am
Quote
I can now report success Grin (adapter registered)

did any sensors show up?
Title: Re: Magic Fingers wanted to get 'DS9490R 1wire usb adapter' working!
Post by: wooly on February 01, 2013, 10:59:14 pm
Techstyle,
Yes just plug sensor in on parasitic reboot and there it was/is as child of 1wire ;D
Title: Re: (NOW WORKING) 'DS9490R 1wire usb adapter' working!
Post by: Techstyle on February 02, 2013, 03:03:48 am
Perhaps I should reboot then, it has been months since I rebooted!
Title: Re: (NOW WORKING) 'DS9490R 1wire usb adapter' working!
Post by: Techstyle on February 03, 2013, 02:58:51 am
I rebooted, 9 hours ago.  still no sensor.  I checked the sensor was connected properly earlier using the maxim graphing tool.
Title: Re: (NOW WORKING) 'DS9490R 1wire usb adapter' working!
Post by: wooly on February 04, 2013, 12:01:23 pm
Techstyle,
This is what I did pulled updates & upgrade(after hari's changes).
Delete exiting 1wire child if have one, create new 1wire child (used wizard).
Went into template and changed: Comm Method was saying 'RS232' so changed to 'Please select'
Under Device data - 37 com port on pc (string) - Default value - was still saying 'dev/ttyS0' so just deleted value and saved template
installing new software message.......wait to finished message
Click restart.
check 1wire says registered.
Plugged in sensor......new software message........finished install message
Restart
back to web-admin child sensor of 1 wire created and showing temp
selected what room sensor is in + gave it a individual name

now shows under climate-floorplan.
Title: Re: (NOW WORKING) 'DS9490R 1wire usb adapter' working!
Post by: Techstyle on February 06, 2013, 02:33:05 pm
I had already done all the things you suggest. I did a couple of reboots after due to some other reasons then all of a sudden the sensor showed up.  not sure I understand it but it is working.  See below

Title: Re: (NOW WORKING) 'DS9490R 1wire usb adapter' working!
Post by: Techstyle on February 06, 2013, 02:34:46 pm
Yes, it is cold in my basement!!

I was trying to set up an event that warns me if the temp drops below 9 deg C but that will be another thread.....
Title: Re: (NOW WORKING) 'DS9490R 1wire usb adapter' working!
Post by: Techstyle on February 22, 2013, 06:53:41 pm
The Device Template was updated, submitted and approved with the two changes in this thread.  The DS9490R should work now with the stock template