Posts Tagged D-Link

CP2102 on DNS-323

In one of my personal projects, I needed to connect and use a USB to RS232 (Serial) converter on my D-Link DNS-323. Weird requirements, I know. Anyway… 😐
Plenty of these converters exist out there, but I choose to go for a CP2102:

Innocently, I first tried to compile the code source of this module which can be found on the following page:
http://www.silabs.com/products/mcu/Pages/USBtoUARTBridgeVCPDrivers.aspx

After a few painful and unsuccessful tries, I decided to look around for the already-compiled module. πŸ˜‰
While wondering why I didn’t think of that before, I used the instructions below to install the required modules on my NAS:

cd /mnt/HD_a2/ffp/lib/
mkdir modules
mkdir modules/2.6.12.6-arm1
cd modules/2.6.12.6-arm1
wget http://dev.skcserver.de/dns323/modules_v1.03/kernel/drivers/usb/serial/usbserial.ko
wget http://dev.skcserver.de/dns323/modules_v1.03/kernel/drivers/usb/serial/cp2101.ko
chmod 755 usbserial.ko
chmod 755 cp2101.ko

Once the modules are installed, the next step is to initialize them.
I wrote the following script for this purpose so you can execute it anytime you need it:

#!/bin/sh

insmod /ffp/lib/modules/2.6.12.6-arm1/usbserial.ko
insmod /ffp/lib/modules/2.6.12.6-arm1/cp2101.ko
mknod /dev/ttyUSB0 c 188 0
chmod 0666 /dev/ttyUSB0

At this point in time, you should have your module initialized on your D-Link DNS-323.
You can check the kernel ring buffer using the dmesg command to verify it loaded properly.
This is a snapshot of what I have in my kernel ring buffer after I ran the script above:

usbcore: registered new driver usbserial
drivers/usb/serial/usb-serial.c: USB Serial support registered for Generic
usbcore: registered new driver usbserial_generic
drivers/usb/serial/usb-serial.c: USB Serial Driver core v2.0
drivers/usb/serial/usb-serial.c: USB Serial support registered for CP2101
CP2101 1-1:1.0: CP2101 converter detected
usb 1-1: reset full speed USB device using ehci_platform and address 5
usb 1-1: CP2101 converter now attached to ttyUSB0
usbcore: registered new driver CP2101
drivers/usb/serial/cp2101.c: Silicon Labs CP2101/CP2102 RS232 serial adaptor driver v0.04

Finally, you can test the communication with your USB to RS232 converter by connecting a LED between the RXD and 3V outputs and running the following script:

#!/bin/sh

while [ true ]
do
echo "hello world!!!" > /dev/ttyUSB0
echo "sent"
sleep 1
done

If you see the LED blinking, it means you succeed! πŸ˜€

, , , , , , , , ,

3 Comments

Samba access problem with Mac OS X 10.6+

This is a problem I encountered when I upgraded Mac OS X from the version 10.5 (Leopard) to 10.6 (Snow Leopard). One of my friend also got a similar problem when she upgraded to the version 10.7 (Lion).
This issue was affecting the access to the network shares set up with Samba (version 3.0.24) on my D-Link DNS-323. For some reason, I wasn’t able to authenticate on the shares as soon as I upgraded to Snow Leopard!

Here is the error message I was getting:

After browsing a few forums on the web, I finally found a solution. πŸ™‚
I simply had to change the security mode in the Samba configuration file (smb.conf) to read:

security = USER

Note that this property can be found under the [global] section.

For more information about the Samba security mode, please read the following article by Jack Wallen:
Understanding Samba security modes

, , , , ,

No Comments

Permissions ignored with Samba

After the issue regarding the ntpd process, I encountered another problem with my D-Link DNS-313. This time it was about permissions problem using Samba.

Because I have multiple user accounts sharing the same data, I added the following lines into the Samba configuration file (smb.conf):

create mask = 0774
directory mask  = 0775
force create mode = 0774
force directory mode = 0775

With these properties, a user will have the permission to read any files created by another user and will also be able to edit them if both users are part of the same group.

However, it appeared that these properties had been ignored by Samba! πŸ™ Please note that the client was a Mac OS X 10.6.6 (Snow Leopard) and the Samba version on the NAS was 3.0.25a.

After some googling on the web, I found the following explanation on the contribs.org forum:

Samba 3.0.2x has the ‘unix extensions’ option set to ‘on’ by default. This allows Unix users who write to the Samba shares to set their own permissions bits. Mac OS X up until now has never attempted to do this, but from Leopard, any directory that gets created on a Samba share, get chmod’ed through this Samba extension.

Alright, this is clear enough! This means that we have to set the ‘unix extensions’ option to ‘no’ in our Samba configuration file:

unix extensions = no

The problem should be gone after restarting Samba. πŸ™‚

, , , , , ,

7 Comments

ntpd process on D-Link DNS-313

During the configuration of a D-Link DNS-313 which is basically a NAS (Network-Attached Storage), I got a serious but easy-to-fix problem. πŸ™‚

In order to get access to the box by command line, I installed the Fonz fun_plug. I then wanted to automatically synchronise the internal time with some NTP Pool Time Servers. But, for some reason, the version of the ntpd process provided with fun_plug is completely freezing the NAS. I wasn’t able to find the root cause of it, trust me, I tried everything I could think of!
Please also note that the same process is working perfectly fine on his brother, the D-Link DNS-323. As I said, I can’t explain why… πŸ™„

But there is a good news! The ntpd process is actually part of the D-Link DNS-313 firmware. And it is working fine! πŸ˜€ After double-checking, this process is however NOT part of the D-Link DNS-323 firmware. Why is that? Maybe D-Link got complaints from DNS-313 users and fixed it? Who knows…

Anyway, in order to get the ntpd process to work on the D-Link DNS-313, you need to replace the content of your ntpd startup script (/ffp/start/ntpd.sh) by the one below:

#!/ffp/bin/sh

# PROVIDE: ntpd
# REQUIRE: SERVERS
# BEFORE: LOGIN

. /ffp/etc/ffp.subr

name="ntpd"
command="/usr/sbin/ntpd"
ntpd_flags="-f /ffp/etc/ntpd.conf"
required_files="/ffp/etc/ntpd.conf"
start_cmd="ntpd_start"

ntpd_start()
{
    # remove rtc and daylight cron jobs
    crontab -l | grep -vw '/usr/sbin/daylight' | grep -vw '/usr/sbin/rtc' | crontab -

    proc_start $command
}

run_rc_command "$1"

, , , , , , , , ,

1 Comment