HOW-TO: CUL, Netgear ReadyNAS and CUL

174 views
Skip to first unread message
Message has been deleted

ATH

unread,
Mar 21, 2011, 6:57:01 PM3/21/11
to FHEM users
How to install FHEM 5.0 on a Netgear ReadyNAS Duo

Document created and compiled by A. Thobaben referencing various other
sources.
This "How-To" is provided "as it is" - read through it, understand it
and use it at your OWN RISK.
The Author is not responsible of the loss of time, date and nerves.
Considering donation to the red cross to help japan and step away from
nuklear power generation - consider alternatives.


1) Update to the latestet Firmware (4.1.7)
2) Get SSH access:
A. Download the EnableRootSSH extension. I've used the following
link:

http://www.readynas.com/download/addons/4.00/EnableRootSSH_1.0.bin

B. Go in the ReadyNAS FrontView with your browser and go to System -
> Update -> Local Update
C. Upload the EnableRootSSH binary file. The ReadyNAS verifies that
content and if it is correct it displays a description of the addon.

3) Get the so called development enviroment up and running
Follow the instructions under: http://www.readynas.com/?p=145

Create the missing system link between the gcc binary and cc
otherwise the make command with the GPL Sources will fail. Use the
following command:
cd /usr/bin
ln -sn cc gcc

4) Create a folder "GPL" under /c/ and download the GPL Sources
(~480MB)using the following commands:
cd /c
mkdir GPL
cd GPL
wget http://www.readynas.com/download/GPL/RNR4_RND4_RND2_4.1.7_WW_src.zip
>> Hint: check the following URL for your NAS: http://www.readynas.com/?page_id=2324
<<
unzip RNR4_RND4_RND2_4.1.7_WW_src.zip

5) Setup the configuration for padre. Therefore "cd" to the linux
kernel directory
cd /c/GPL/linux-2.6.17.14/
and run
cp arch/padre/defconfig .config

6) There is a hardcoded cross-compile setup in the kernel build, which
needs to be fixed. Edit arch/padre/Makefile, and replace the line that
starts with "CROSS_COMPILE" with one like this

CROSS_COMPILE ?=


7) Install the APT-Addon - follow the instructions under:
http://www.readynas.com/?p=4216

8) Install libncurses5-dev using the following command:
apt-get install libncurses5-dev

9) Configure the compilation of the missing USB Modules using the
following command:
make menuconfig

>> Hint: make menuconfig take quite a while on the little box. In
the end it gives you the installation screen to configure the kernel
modules.
With this tool you can end up easily in reinstalling everthing form
defaults. I did this myself... .
You have to configure the modem usb drivers (we are looking for the
cdc_acm module).
USE AT YOUR OWN RISK! <<

compile the modules:
make modules
>> Hint: Takes time as well... <<

and install the compiled modules using:
make modules_install

10) Reinstall Perl, it's tools and libraries
apt-get --reinstall install perl perl-base perl-modules perl-doc

11) update CPAN
apt-get install cpan
>> Hint: Endless session with a couple of questions in between. You
will sit longtime in fornt of the terminal but needed.... <<


12) install Device::Serial in a version greater than 1.x
cpan install Device::SerialPort

13) Install the screen tool
apt-get install screen

14) Install FHEM 5.0 from sources or from .deb file

15) Configure FHEM with you setting and devices (here my sample)

#
# pgm2 / autocreate configfile. Take a look at the other
examples for more.
#
attr global logfile /var/log/fhem/fhem-%Y-%m.log
attr global modpath /usr/share/fhem # where
our FHEM directory is
attr global port 7072 # our TCP/IP port
(localhost only)
attr global statefile /var/log/fhem/fhem.save # where to
save the state of the devices
attr global verbose 3 # "normal" verbosity
(min 1, max 5)

define CUL CUL /dev/ttyACM0 1234
#define FHEM FHEM /dev/USB0

define WEB FHEMWEB 8083 global

define WEBS FHEMWEB 8084 global
attr WEBS smallscreen

# Fake logfile, to access the global log
define Logfile FileLog /var/log/fhem/fhem-%Y-%m.log fakelog

define Arbeitszimmer FS20 1234 10
define Kinderzimmer FS20 1234 20
define Mobil_Lampe FS20 1234 30

# Comment out for initial testing....
#
# define autocreate autocreate
# attr autocreate autosave
# attr autocreate device_room %TYPE
# attr autocreate filelog /var/log/fhem/%NAME-%Y.log
# attr autocreate weblink
# attr autocreate weblink_room Plots


16) Flash CUL with the latest firmware (culfw 1.40) if needed

17) Reboot the whole thing

18) Load the module by running:
insmod cdc_acm.ko

19) Attach the CUL to the USB Slot (I used the front one)and check the
syslog:
tail --lines=100 /var/log/syslog

You should see something like this:
...
Mar 21 21:10:44 -NAS kernel: usb 3-1: new full speed USB device
using uhci_hcd and address 6
Mar 21 21:10:44 -NAS kernel: usb 3-1: configuration #1 chosen from
1 choice
Mar 21 21:10:44 -NAS kernel: cdc_acm 3-1:1.0: ttyACM0: USB ACM
device
Mar 21 21:10:54 -NAS usb.agent: ... no modules for USB product 3eb/
204b/0
....
Only the "no modules message" looks scary.


20) Check with the following:
lsusb

Gives you:
Bus 003 Device 006: ID 03eb:204b Atmel Corp. <<< This is your
CUL...
Bus 003 Device 001: ID 0000:0000
Bus 002 Device 001: ID 0000:0000
Bus 001 Device 001: ID 0000:0000


21) test the usb device with
screen /dev/ttyACM0
press "V" (Shift-V) and you should see the Version String of the CUL
Firmware
unplug the CUL for some seconed to kill screen...

22) start FHEM
perl /usr/bin/fhem.pl /etc/fhem.cfg

23) Check fhem.log by using:
tail -lines=100 /var/log/fhem/YOURFHEM.LOG
You should not see any warning and the device must be read.

Might looks like this:
....
2011.03.21 23:35:14 3: CUL opening CUL device /dev/ttyACM0
2011.03.21 23:35:14 3: CUL device opened
2011.03.21 23:35:15 2: FHEMWEB port 8083 opened
2011.03.21 23:35:15 2: FHEMWEB port 8084 opened
2011.03.21 23:35:15 0: Server started (version 5.0 from 2010-08-15
($Id: fhem.pl,v 1.110 2010-08-14 10:35:12 rudolfkoenig Exp $), pid
12398)
2011.03.21 23:35:46 2: FS20 set Arbeitszimmer on
2011.03.21 23:35:56 2: FS20 set Arbeitszimmer off
....

24) Startup your webbrowser and navigate to the NAS URL
http://your-ReadyNAS:8083/fhem
You should see the settings under "unsorted" and you can switch on
the lights...

Works fine :-)
Reply all
Reply to author
Forward
0 new messages