DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

Announcement

#26 2014-10-25 01:54:56

dom323
Member
Registered: 2011-04-14
Posts: 37

Re: Using the DNS-323 as a Fax Server

Possibly answering my own question here. I found a little application called daemon, and I was able to get it to compile as an ffp package. I tried spawning the 'fax answer' process with it, and it seems to have worked. I received a fax and after several minutes, the process is still running.

So, I can probably just make an /ffp/start/faxd.sh script that calls daemon like so:

Code:

daemon --respawn /ffp/bin/fax answer

It might be difficult to provide the normal (stop|start|restart) functionality that most ffp start scripts expect, but I'm mostly just interested in keeping it running while the NAS is on. Any thoughts on this solution, or the samba printer issue?

Offline

 

#27 2014-10-25 11:25:48

Mijzelf
Member / Developer
Registered: 2008-07-05
Posts: 709

Re: Using the DNS-323 as a Fax Server

Some thoughts: You are writing about baudrate and hylafax. I think the baudrate doesn't matter. There is nowhere are 'real'  serial device involved. The fax-box has a digital and an analog side. The digital side is usb, and the analog side is anyway negotiating with it's discussion partner about the baudrate. That has no influence on the digital side. So I think the baudrate on digital side is simply ignored

read(4, "# $Id: class1.0 1085 2012-02-14 0"..., 4096) = 4096

On first sight it seems that parsing that string crashes the program. So if you can turn off the 'autodetect', that could help.

About receiving faxes and notification email: You could write a little script:

Code:

#!/ffp/bin/sh

ProcessIncomingFax()
{
    newfax=$1
    fax2ps $newfile | ps2pdf >/path/to/faxshare/$newfax.pdf
    if [ $? -eq 0 ] ; then
        cat <<__EOF__ |  ssmtp "someone@elsewhe.re"
Subject: Fax

I'm pleased to tell you a new fax arrived: $newfax.pfd
__EOF__
    else
        cat <<__EOF__ |  ssmtp "someone@elsewhe.re"
Subject: Fax

Something went wrong while converting fax $newfax
__EOF__
    fi
}

while [ true ] ; do
    /ffp/bin/fax answer
    if [ -f <recievedfaxfile> ] ; then
        newname=$( date +%Y%m%d%H%M%S )
        mv <receivedfaxfile> $newname
        ProcessIncomingFax $newname &
    fi
done

About sending faxes, sorry, I'm not very into printers. I think you have to setup a pdf printer on cups (does the nashas cups?), and some notification script, or a polling script should fax it. I guess it first has to kill the listening daemon, only one process can use the faxdevice. So the 'while [ true ]' becomes 'while [ ! -f /tmp/faxtosend ]' or something like that.

I don't think there is a way for the pdf printer to ask for the faxnumber. Would a webinterface be an option? It's not too hard to write a little cgi script, which shows the waiting faxes, and gives a way to enter a faxnumber for them.
Another way is to setup a simple mailserver, and mail a pdf to the nas, with the number as subject, or something like that. But then it is possible that the pdf becomes too complex for your poor little pdf convertor.

Offline

 

#28 2014-10-27 22:13:25

dom323
Member
Registered: 2011-04-14
Posts: 37

Re: Using the DNS-323 as a Fax Server

Thanks for the guidance. I think you are right about the irrelevance of the baudrate. I only pointed that out to demonstrate how HylaFAX was unable to communicate with the modem. I feel like I'm close to a working system with efax, so I want to keep pushing ahead with that before I give up and return to trying to get HylaFAX working again.

The problem I'm running into now is with the fax "printer". Unfortunately, the NAS doesn't have CUPS. It uses what looks like a stripped down version of LPRng. I know very little about this software, but from the efax documentation (see the "Sending Faxes Using The Print Spooler" section) it should be very simple to get this working. I followed those instructions, restarted the lpd and samba services, and now a samba shared printer called "fax" shows up (so far so good).

I installed the printer with a generic postscript driver, but when I try to print to it, the following shows up on my SSH console:

Code:

sending job 'nobody@NAS-7378C5+450' to fax@localhost
 connecting to 'localhost', attempt 1
 connected to 'localhost'
 requesting printer fax@localhost
 job 'nobody@NAS-7378C5+450' transfer to fax@localhost failed
  error 'link error 253' with ack 'ACK_FAIL'
  sending str '^Bfax' to fax@localhost
 error msg: 'spool queue for 'fax' does not exist on server NAS-7378C5'
 error msg: '   non-existent printer or you need to run 'checkpc -f''

I get the same message when I try to use the NAS's lpr command to send a job to the "fax" printer. Of course, I've checked and the "spool" directory does exist and is chmod 777, so I'm feeling pretty stuck. When I run "lpq" I only see information on the DNS built in "lp USB Printer" and nothing about the fax printer. So, it seems like LPRng doesn't "know" about the fax printer even though it's in the printcap file and Samba recognizes and shares it.

I know printers aren't your thing, but do you have any ideas for me at this point?

Last edited by dom323 (2014-10-27 22:14:09)

Offline

 

#29 2014-10-29 11:34:50

Mijzelf
Member / Developer
Registered: 2008-07-05
Posts: 709

Re: Using the DNS-323 as a Fax Server

dom323 wrote:

do you have any ideas for me at this point?

A long shot.

Code:

ln -s /usr/bin/fax /usr/bin/faxlpr

I guess /usr/bin/fax here is a script/binary which runs in the FFP environment. It will be called by LPRng which runs in the firmware environment, which *can* make /usr/bin/fax misbehave.

If that is true, an extra script could solve the issue. /usr/bin/faxffp.sh:

Code:

#!/bin/sh

export PATH=/ffp/bin:/ffp/sbin:$PATH

# other ffp environment settings

exec /usr/bin/fax

Code:

ln -s /usr/bin/faxffp.sh /usr/bin/faxlpr

Now the environment is set before /usr/bin/fax is called. And it's still running as /usr/bin/faxlpr due to the 'exec'.

BTW, how is the faxnumber distributed?

Offline

 

#30 2014-10-30 21:08:00

dom323
Member
Registered: 2011-04-14
Posts: 37

Re: Using the DNS-323 as a Fax Server

Thanks for the help. That's an interesting idea, but I'm pretty sure that the process isn't even getting that far. I don't think the '/ffp/bin/faxlpr' script is ever called.

You're right, by the way, in assuming that '/ffp/bin/fax' is just a bash script which runs in the FFP environment. My problem is that I can't get the firmware LPRng to "transfer" the printing job to the "fax" printer. I think the "spool queue for 'fax' doesn't exist" is probably the issue, but LPRng is very new to me, and I haven't had very much time lately to tinker with it.

To answer your question the recipient's fax number is communicated using the 'lpr' command's -J (job name) flag. So, my plan was to enable the LPR command on my Window's clients, and then use a simple batch script to collect the phone number from the sender and transmit the job. Of course, that's failing as well, with an error saying that the server is rejecting the print job. My plan was to tackle that problem once I was able to get the lpr command on the device itself working.

In other news, I was able to get the system for receiving faxes figured out. I borrowed some of the code from the script in your previous post. So, basically, I added a bash function to the /ffp/bin/fax script which gets called when a fax comes in. It converts the fax to a single PDF file and copies it to an accessible place. Then, it sends a list of people in my office a notification email with the name of the file. Then, they just have to hop on the local network and view the PDF file. So far it has worked pretty well, but occasionally it will miss a fax. The line will just ring until my back up fax machine picks it up. Very strange. All I see in the logs is a cryptic "Invalid modem response" error, and because the log time stamps are so weird, I can't even be 100% sure that that error refers to the missed fax. I will post an update if I'm able to track down the issue better.

As always, thank you very much for all the help.

Offline

 

#31 2014-10-30 21:37:38

Mijzelf
Member / Developer
Registered: 2008-07-05
Posts: 709

Re: Using the DNS-323 as a Fax Server

Maybe strace can help.

Code:

strace -o /path/to/logfile -ff lprd <args>

will generate logfiles for all system calls of lprd and it's forks. I might tell you which file/directory is missing to meet te print request.

Offline

 

#32 2014-10-31 00:58:43

dom323
Member
Registered: 2011-04-14
Posts: 37

Re: Using the DNS-323 as a Fax Server

Good idea. I tried that, and I wasn't able to get anything intelligible. It looks like the 'lpd' process forks when a new job comes in. The -ff option creates a new log file for the forked process, but it's always blank. Strange.

I also tried running strace on the lpr command. I ran two tests. First, I tried printing to the built in "lp" printer and then the new "fax" printer. No errors were output on the first attempt, so I beleive the job was added to the "lp" printer's queue. I received the same error I posted earlier when I tried printing to the "fax" printer. The two strace outputs are very similar. And it's really difficult for me to determine anything useful in them, but I will post them both here just in case they make sense to anyone else.

Attempt 1, printing to "lp"

Code:

execve("/usr/local/LPRng/bin/lpr", ["/usr/local/LPRng/bin/lpr", "-P", "lp", "/mnt/HD_a2/date.txt"], [/* 16 vars */]) = 0
execve("/usr/local/LPRng/bin/lpr", ["/usr/local/LPRng/bin/lpr", "-P", "lp", "/mnt/HD_a2/date.txt"], [/* 16 vars */]) = 0
old_mmap(NULL, 20, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40005000
stat("/etc/ld-uclibc.so.cache", 0xbee18a5c) = -1 ENOENT (No such file or directory)
open("/usr/local/LPRng/lib/liblpr.so.0", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/lib/liblpr.so.0", O_RDONLY)      = 3
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40006000
read(3, "\177ELF\1\1\1a\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0t\377\0\0004\0\0\0\0"..., 4096) = 4096
old_mmap(NULL, 684032, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x4000d000
old_mmap(0x4000d000, 625292, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 0) = 0x4000d000
old_mmap(0x400ad000, 22552, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x98000) = 0x400ad000
old_mmap(0x400b3000, 692, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x400b3000
close(3)                                = 0
munmap(0x40006000, 4096)                = 0
open("/usr/local/LPRng/lib/libc.so.0", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/lib/libc.so.0", O_RDONLY)        = 3
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40006000
read(3, "\177ELF\1\1\1a\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0`\346\0\0004\0\0\0x"..., 4096) = 4096
old_mmap(NULL, 364544, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x400b4000
old_mmap(0x400b4000, 306644, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 0) = 0x400b4000
old_mmap(0x40106000, 7876, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x4a000) = 0x40106000
old_mmap(0x40108000, 18528, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x40108000
close(3)                                = 0
munmap(0x40006000, 4096)                = 0
open("/usr/local/LPRng/lib/libgcc_s.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/lib/libgcc_s.so.1", O_RDONLY)    = 3
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40006000
read(3, "\177ELF\1\1\1a\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0000\24\0\0004\0\0\0004"..., 4096) = 4096
old_mmap(NULL, 69632, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x4010d000
old_mmap(0x4010d000, 34914, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 0) = 0x4010d000
old_mmap(0x4011d000, 2712, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x8000) = 0x4011d000
close(3)                                = 0
munmap(0x40006000, 4096)                = 0
ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
ioctl(1, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbee18a0c) = -1 ENOTTY (Inappropriate ioctl for device)
rt_sigaction(SIGHUP, {0xa1cc, [], SA_RESTART|0x4000000}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGINT, {0xa3a0, [], SA_RESTART|0x4000000}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGQUIT, {0xa52c, [], SA_RESTART|0x4000000}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGTERM, {0xa1a8, [], SA_RESTART|0x4000000}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGCHLD, {SIG_DFL, [CHLD], SA_RESTART|0x4000000}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGPIPE, {0x1, [PIPE], SA_RESTART|0x4000000}, {SIG_DFL, [], 0}, 8) = 0
getuid()                                = 0
open("/dev/null", O_RDWR)               = 3
close(3)                                = 0
brk(0)                                  = 0x1b000
brk(0x1c000)                            = 0x1c000
umask(077)                              = 022
geteuid()                               = 0
getuid()                                = 0
getegid()                               = 0
getgid()                                = 0
setuid(0)                               = 0
setresuid(65535, 0, 65535)              = 0
getuid()                                = 0
stat("/usr/local/LPRng/etc/lpd.conf", {st_mode=S_IFREG|0744, st_size=18887, ...}) = 0
open("/usr/local/LPRng/etc/lpd.conf", O_RDONLY|O_NOCTTY) = 3
fstat(3, {st_mode=S_IFREG|0744, st_size=18887, ...}) = 0
read(3, "# lpd.conf\n# VERSION=3.8.10\n# lpd"..., 10239) = 10239
brk(0x1f000)                            = 0x1f000
read(3, "tional options for LPR\n#   defaul"..., 10239) = 8648
brk(0x23000)                            = 0x23000
read(3, ""..., 10239)                   = 0
close(3)                                = 0
uname({sys="Linux", node="NAS-7379C5", ...}) = 0
open("/etc/resolv.conf", O_RDONLY)      = 3
ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbee18168) = -1 ENOTTY (Inappropriate ioctl for device)
read(3, "nameserver 192.168.1.1\n"..., 4096) = 23
read(3, ""..., 4096)                    = 0
close(3)                                = 0
open("/etc/hosts", O_RDONLY)            = 3
ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbee181b4) = -1 ENOTTY (Inappropriate ioctl for device)
read(3, "127.0.0.1 localhost.localdomain l"..., 4096) = 79
close(3)                                = 0
open("/etc/hosts", O_RDONLY)            = 3
ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbee18144) = -1 ENOTTY (Inappropriate ioctl for device)
read(3, "127.0.0.1 localhost.localdomain l"..., 4096) = 79
close(3)                                = 0
open("/etc/hosts", O_RDONLY)            = 3
ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbee181b4) = -1 ENOTTY (Inappropriate ioctl for device)
read(3, "127.0.0.1 localhost.localdomain l"..., 4096) = 79
close(3)                                = 0
open("/etc/passwd", O_RDONLY)           = 3
ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbee183cc) = -1 ENOTTY (Inappropriate ioctl for device)
read(3, "root:x:0:0:Linux User,,,:/ffp/hom"..., 4096) = 275
read(3, ""..., 4096)                    = 0
close(3)                                = 0
getuid()                                = 0
open("/etc/group", O_RDONLY)            = 3
ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbee183cc) = -1 ENOTTY (Inappropriate ioctl for device)
read(3, "root:x:0:root\n500:x:500:admin\n501"..., 4096) = 89
read(3, ""..., 4096)                    = 0
close(3)                                = 0
getgid()                                = 0
open("/etc/passwd", O_RDONLY)           = 3
ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbee183cc) = -1 ENOTTY (Inappropriate ioctl for device)
read(3, "root:x:0:0:Linux User,,,:/ffp/hom"..., 4096) = 275
close(3)                                = 0
stat("/usr/local/LPRng/etc/printcap", {st_mode=S_IFREG|0744, st_size=201, ...}) = 0
open("/usr/local/LPRng/etc/printcap", O_RDONLY|O_NOCTTY) = 3
fstat(3, {st_mode=S_IFREG|0744, st_size=201, ...}) = 0
read(3, "lp|USB Printer:\\\n        :sh:\\\n  "..., 10239) = 201
read(3, ""..., 10239)                   = 0
close(3)                                = 0
stat("/ffp/home/root/.printcap", 0xbee18354) = -1 ENOENT (No such file or directory)
getpid()                                = 12140
open("/mnt/HD_a2/date.txt", O_RDONLY|O_NOCTTY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=29, ...}) = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=29, ...}) = 0
close(3)                                = 0
gettimeofday({1414707843, 992459}, NULL) = 0
open("/etc/TZ", O_RDONLY)               = 3
read(3, "GMT+08:00\n"..., 68)           = 10
read(3, ""..., 58)                      = 0
close(3)                                = 0
geteuid()                               = 0
open("/etc/hosts", O_RDONLY)            = 3
ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbee156c8) = -1 ENOTTY (Inappropriate ioctl for device)
read(3, "127.0.0.1 localhost.localdomain l"..., 4096) = 79
close(3)                                = 0
rt_sigprocmask(SIG_SETMASK, ~[], [], 8) = 0
setuid(0)                               = 0
setresuid(65535, 0, 65535)              = 0
geteuid()                               = 0
socket(PF_FILE, SOCK_STREAM, 0)         = 3
setuid(0)                               = 0
setresuid(65535, 0, 65535)              = 0
geteuid()                               = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
alarm(0)                                = 0
rt_sigaction(SIGALRM, {0x1, [ALRM], SA_RESTART|0x4000000}, {SIG_DFL, [], 0}, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [ALRM], [], 8) = 0
rt_sigaction(SIGALRM, {0x400874e0, [], SA_INTERRUPT|0x4000000}, {0x1, [ALRM], SA_RESTART|0x4000000}, 8) = 0
alarm(10)                               = 0
connect(3, {sa_family=AF_FILE, path="/var/run/lprng"...}, 112) = 0
rt_sigaction(SIGALRM, {0x1, [ALRM], SA_RESTART|0x4000000}, {0x400874e0, [], SA_INTERRUPT|0x4000000}, 8) = 0
alarm(0)                                = 10
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
alarm(0)                                = 0
rt_sigaction(SIGALRM, {0x1, [ALRM], SA_RESTART|0x4000000}, {0x1, [ALRM], SA_RESTART|0x4000000}, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [ALRM], [], 8) = 0
rt_sigaction(SIGALRM, {0x400874e0, [], SA_INTERRUPT|0x4000000}, {0x1, [ALRM], SA_RESTART|0x4000000}, 8) = 0
alarm(6000)                             = 0
write(3, "\2lp\n"..., 4)                = 4
rt_sigaction(SIGALRM, {0x1, [ALRM], SA_RESTART|0x4000000}, {0x400874e0, [], SA_INTERRUPT|0x4000000}, 8) = 0
alarm(0)                                = 6000
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
alarm(0)                                = 0
rt_sigaction(SIGALRM, {0x1, [ALRM], SA_RESTART|0x4000000}, {0x1, [ALRM], SA_RESTART|0x4000000}, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [ALRM], [], 8) = 0
rt_sigaction(SIGALRM, {0x400874e0, [], SA_INTERRUPT|0x4000000}, {0x1, [ALRM], SA_RESTART|0x4000000}, 8) = 0
alarm(6000)                             = 0
read(3, "\0"..., 1)                     = 1
rt_sigaction(SIGALRM, {0x1, [ALRM], SA_RESTART|0x4000000}, {0x400874e0, [], SA_INTERRUPT|0x4000000}, 8) = 0
alarm(0)                                = 6000
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
alarm(0)                                = 0
rt_sigaction(SIGALRM, {0x1, [ALRM], SA_RESTART|0x4000000}, {0x1, [ALRM], SA_RESTART|0x4000000}, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [ALRM], [], 8) = 0
rt_sigaction(SIGALRM, {0x400874e0, [], SA_INTERRUPT|0x4000000}, {0x1, [ALRM], SA_RESTART|0x4000000}, 8) = 0
alarm(6000)                             = 0
write(3, "\002149 cfA140NAS-7379C5\n"..., 22) = 22
rt_sigaction(SIGALRM, {0x1, [ALRM], SA_RESTART|0x4000000}, {0x400874e0, [], SA_INTERRUPT|0x4000000}, 8) = 0
alarm(0)                                = 6000
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
alarm(0)                                = 0
rt_sigaction(SIGALRM, {0x1, [ALRM], SA_RESTART|0x4000000}, {0x1, [ALRM], SA_RESTART|0x4000000}, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [ALRM], [], 8) = 0
rt_sigaction(SIGALRM, {0x400874e0, [], SA_INTERRUPT|0x4000000}, {0x1, [ALRM], SA_RESTART|0x4000000}, 8) = 0
alarm(6000)                             = 0
read(3, "\0"..., 1)                     = 1
rt_sigaction(SIGALRM, {0x1, [ALRM], SA_RESTART|0x4000000}, {0x400874e0, [], SA_INTERRUPT|0x4000000}, 8) = 0
alarm(0)                                = 6000
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
alarm(0)                                = 0
rt_sigaction(SIGALRM, {0x1, [ALRM], SA_RESTART|0x4000000}, {0x1, [ALRM], SA_RESTART|0x4000000}, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [ALRM], [], 8) = 0
rt_sigaction(SIGALRM, {0x400874e0, [], SA_INTERRUPT|0x4000000}, {0x1, [ALRM], SA_RESTART|0x4000000}, 8) = 0
alarm(6000)                             = 0
write(3, "HNAS-7379C5\nProot\nJ/mnt/HD_a2/dat"..., 150) = 150
rt_sigaction(SIGALRM, {0x1, [ALRM], SA_RESTART|0x4000000}, {0x400874e0, [], SA_INTERRUPT|0x4000000}, 8) = 0
alarm(0)                                = 6000
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
alarm(0)                                = 0
rt_sigaction(SIGALRM, {0x1, [ALRM], SA_RESTART|0x4000000}, {0x1, [ALRM], SA_RESTART|0x4000000}, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [ALRM], [], 8) = 0
rt_sigaction(SIGALRM, {0x400874e0, [], SA_INTERRUPT|0x4000000}, {0x1, [ALRM], SA_RESTART|0x4000000}, 8) = 0
alarm(6000)                             = 0
read(3, "\0"..., 1)                     = 1
rt_sigaction(SIGALRM, {0x1, [ALRM], SA_RESTART|0x4000000}, {0x400874e0, [], SA_INTERRUPT|0x4000000}, 8) = 0
alarm(0)                                = 6000
open("/mnt/HD_a2/date.txt", O_RDONLY|O_NOCTTY) = 4
fstat(4, {st_mode=S_IFREG|0644, st_size=29, ...}) = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
alarm(0)                                = 0
rt_sigaction(SIGALRM, {0x1, [ALRM], SA_RESTART|0x4000000}, {0x1, [ALRM], SA_RESTART|0x4000000}, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [ALRM], [], 8) = 0
rt_sigaction(SIGALRM, {0x400874e0, [], SA_INTERRUPT|0x4000000}, {0x1, [ALRM], SA_RESTART|0x4000000}, 8) = 0
alarm(6000)                             = 0
write(3, "\00329 dfA140NAS-7379C5\n"..., 21) = 21
rt_sigaction(SIGALRM, {0x1, [ALRM], SA_RESTART|0x4000000}, {0x400874e0, [], SA_INTERRUPT|0x4000000}, 8) = 0
alarm(0)                                = 6000
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
alarm(0)                                = 0
rt_sigaction(SIGALRM, {0x1, [ALRM], SA_RESTART|0x4000000}, {0x1, [ALRM], SA_RESTART|0x4000000}, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [ALRM], [], 8) = 0
rt_sigaction(SIGALRM, {0x400874e0, [], SA_INTERRUPT|0x4000000}, {0x1, [ALRM], SA_RESTART|0x4000000}, 8) = 0
alarm(6000)                             = 0
read(3, "\0"..., 1)                     = 1
rt_sigaction(SIGALRM, {0x1, [ALRM], SA_RESTART|0x4000000}, {0x400874e0, [], SA_INTERRUPT|0x4000000}, 8) = 0
alarm(0)                                = 6000
read(4, "Thu Oct 30 14:22:35 GMT 2014\n"..., 29) = 29
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
alarm(0)                                = 0
rt_sigaction(SIGALRM, {0x1, [ALRM], SA_RESTART|0x4000000}, {0x1, [ALRM], SA_RESTART|0x4000000}, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [ALRM], [], 8) = 0
rt_sigaction(SIGALRM, {0x400874e0, [], SA_INTERRUPT|0x4000000}, {0x1, [ALRM], SA_RESTART|0x4000000}, 8) = 0
alarm(6000)                             = 0
write(3, "Thu Oct 30 14:22:35 GMT 2014\n"..., 29) = 29
rt_sigaction(SIGALRM, {0x1, [ALRM], SA_RESTART|0x4000000}, {0x400874e0, [], SA_INTERRUPT|0x4000000}, 8) = 0
alarm(0)                                = 6000
select(4, [3], NULL, NULL, {0, 0})      = 0 (Timeout)
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
alarm(0)                                = 0
rt_sigaction(SIGALRM, {0x1, [ALRM], SA_RESTART|0x4000000}, {0x1, [ALRM], SA_RESTART|0x4000000}, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [ALRM], [], 8) = 0
rt_sigaction(SIGALRM, {0x400874e0, [], SA_INTERRUPT|0x4000000}, {0x1, [ALRM], SA_RESTART|0x4000000}, 8) = 0
alarm(6000)                             = 0
write(3, "\0"..., 1)                    = 1
rt_sigaction(SIGALRM, {0x1, [ALRM], SA_RESTART|0x4000000}, {0x400874e0, [], SA_INTERRUPT|0x4000000}, 8) = 0
alarm(0)                                = 6000
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
alarm(0)                                = 0
rt_sigaction(SIGALRM, {0x1, [ALRM], SA_RESTART|0x4000000}, {0x1, [ALRM], SA_RESTART|0x4000000}, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [ALRM], [], 8) = 0
rt_sigaction(SIGALRM, {0x400874e0, [], SA_INTERRUPT|0x4000000}, {0x1, [ALRM], SA_RESTART|0x4000000}, 8) = 0
alarm(6000)                             = 0
read(3, "\0"..., 1)                     = 1
rt_sigaction(SIGALRM, {0x1, [ALRM], SA_RESTART|0x4000000}, {0x400874e0, [], SA_INTERRUPT|0x4000000}, 8) = 0
alarm(0)                                = 6000
close(4)                                = 0
fstat(3, {st_mode=S_IFSOCK|0777, st_size=0, ...}) = 0
shutdown(3, 1 /* send */)               = 0
close(3)                                = 0
rt_sigprocmask(SIG_SETMASK, ~[], [], 8) = 0
close(3)                                = -1 EBADF (Bad file descriptor)
getpid()                                = 12140
exit(0)                                 = ?

Attempt 2, printing to "fax"

Code:

execve("/usr/local/LPRng/bin/lpr", ["/usr/local/LPRng/bin/lpr", "-P", "fax", "/mnt/HD_a2/date.txt"], [/* 16 vars */]) = 0
old_mmap(NULL, 20, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40005000
stat("/etc/ld-uclibc.so.cache", 0xbe987a5c) = -1 ENOENT (No such file or directory)
open("/usr/local/LPRng/lib/liblpr.so.0", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/lib/liblpr.so.0", O_RDONLY)      = 3
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40006000
read(3, "\177ELF\1\1\1a\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0t\377\0\0004\0\0\0\0"..., 4096) = 4096
old_mmap(NULL, 684032, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x4000d000
old_mmap(0x4000d000, 625292, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 0) = 0x4000d000
old_mmap(0x400ad000, 22552, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x98000) = 0x400ad000
old_mmap(0x400b3000, 692, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x400b3000
close(3)                                = 0
munmap(0x40006000, 4096)                = 0
open("/usr/local/LPRng/lib/libc.so.0", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/lib/libc.so.0", O_RDONLY)        = 3
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40006000
read(3, "\177ELF\1\1\1a\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0`\346\0\0004\0\0\0x"..., 4096) = 4096
old_mmap(NULL, 364544, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x400b4000
old_mmap(0x400b4000, 306644, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 0) = 0x400b4000
old_mmap(0x40106000, 7876, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x4a000) = 0x40106000
old_mmap(0x40108000, 18528, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x40108000
close(3)                                = 0
munmap(0x40006000, 4096)                = 0
open("/usr/local/LPRng/lib/libgcc_s.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/lib/libgcc_s.so.1", O_RDONLY)    = 3
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40006000
read(3, "\177ELF\1\1\1a\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0000\24\0\0004\0\0\0004"..., 4096) = 4096
old_mmap(NULL, 69632, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x4010d000
old_mmap(0x4010d000, 34914, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 0) = 0x4010d000
old_mmap(0x4011d000, 2712, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x8000) = 0x4011d000
close(3)                                = 0
munmap(0x40006000, 4096)                = 0
ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
ioctl(1, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbe987a0c) = -1 ENOTTY (Inappropriate ioctl for device)
rt_sigaction(SIGHUP, {0xa1cc, [], SA_RESTART|0x4000000}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGINT, {0xa3a0, [], SA_RESTART|0x4000000}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGQUIT, {0xa52c, [], SA_RESTART|0x4000000}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGTERM, {0xa1a8, [], SA_RESTART|0x4000000}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGCHLD, {SIG_DFL, [CHLD], SA_RESTART|0x4000000}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGPIPE, {0x1, [PIPE], SA_RESTART|0x4000000}, {SIG_DFL, [], 0}, 8) = 0
getuid()                                = 0
open("/dev/null", O_RDWR)               = 3
close(3)                                = 0
brk(0)                                  = 0x1b000
brk(0x1c000)                            = 0x1c000
umask(077)                              = 022
geteuid()                               = 0
getuid()                                = 0
getegid()                               = 0
getgid()                                = 0
setuid(0)                               = 0
setresuid(65535, 0, 65535)              = 0
getuid()                                = 0
stat("/usr/local/LPRng/etc/lpd.conf", {st_mode=S_IFREG|0744, st_size=18887, ...}) = 0
open("/usr/local/LPRng/etc/lpd.conf", O_RDONLY|O_NOCTTY) = 3
fstat(3, {st_mode=S_IFREG|0744, st_size=18887, ...}) = 0
read(3, "# lpd.conf\n# VERSION=3.8.10\n# lpd"..., 10239) = 10239
brk(0x1f000)                            = 0x1f000
read(3, "tional options for LPR\n#   defaul"..., 10239) = 8648
brk(0x23000)                            = 0x23000
read(3, ""..., 10239)                   = 0
close(3)                                = 0
uname({sys="Linux", node="NAS-7379C5", ...}) = 0
open("/etc/resolv.conf", O_RDONLY)      = 3
ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbe987168) = -1 ENOTTY (Inappropriate ioctl for device)
read(3, "nameserver 192.168.1.1\n"..., 4096) = 23
read(3, ""..., 4096)                    = 0
close(3)                                = 0
open("/etc/hosts", O_RDONLY)            = 3
ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbe9871b4) = -1 ENOTTY (Inappropriate ioctl for device)
read(3, "127.0.0.1 localhost.localdomain l"..., 4096) = 79
close(3)                                = 0
open("/etc/hosts", O_RDONLY)            = 3
ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbe987144) = -1 ENOTTY (Inappropriate ioctl for device)
read(3, "127.0.0.1 localhost.localdomain l"..., 4096) = 79
close(3)                                = 0
open("/etc/hosts", O_RDONLY)            = 3
ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbe9871b4) = -1 ENOTTY (Inappropriate ioctl for device)
read(3, "127.0.0.1 localhost.localdomain l"..., 4096) = 79
close(3)                                = 0
open("/etc/passwd", O_RDONLY)           = 3
ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbe9873cc) = -1 ENOTTY (Inappropriate ioctl for device)
read(3, "root:x:0:0:Linux User,,,:/ffp/hom"..., 4096) = 275
read(3, ""..., 4096)                    = 0
close(3)                                = 0
getuid()                                = 0
open("/etc/group", O_RDONLY)            = 3
ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbe9873cc) = -1 ENOTTY (Inappropriate ioctl for device)
read(3, "root:x:0:root\n500:x:500:admin\n501"..., 4096) = 89
read(3, ""..., 4096)                    = 0
close(3)                                = 0
getgid()                                = 0
open("/etc/passwd", O_RDONLY)           = 3
ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbe9873cc) = -1 ENOTTY (Inappropriate ioctl for device)
read(3, "root:x:0:0:Linux User,,,:/ffp/hom"..., 4096) = 275
close(3)                                = 0
stat("/usr/local/LPRng/etc/printcap", {st_mode=S_IFREG|0744, st_size=201, ...}) = 0
open("/usr/local/LPRng/etc/printcap", O_RDONLY|O_NOCTTY) = 3
fstat(3, {st_mode=S_IFREG|0744, st_size=201, ...}) = 0
read(3, "lp|USB Printer:\\\n        :sh:\\\n  "..., 10239) = 201
read(3, ""..., 10239)                   = 0
close(3)                                = 0
stat("/ffp/home/root/.printcap", 0xbe987354) = -1 ENOENT (No such file or directory)
getpid()                                = 12193
open("/mnt/HD_a2/date.txt", O_RDONLY|O_NOCTTY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=29, ...}) = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=29, ...}) = 0
close(3)                                = 0
gettimeofday({1414707900, 838366}, NULL) = 0
open("/etc/TZ", O_RDONLY)               = 3
read(3, "GMT+08:00\n"..., 68)           = 10
read(3, ""..., 58)                      = 0
close(3)                                = 0
geteuid()                               = 0
open("/etc/hosts", O_RDONLY)            = 3
ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbe9846c8) = -1 ENOTTY (Inappropriate ioctl for device)
read(3, "127.0.0.1 localhost.localdomain l"..., 4096) = 79
close(3)                                = 0
rt_sigprocmask(SIG_SETMASK, ~[], [], 8) = 0
setuid(0)                               = 0
setresuid(65535, 0, 65535)              = 0
geteuid()                               = 0
socket(PF_FILE, SOCK_STREAM, 0)         = 3
setuid(0)                               = 0
setresuid(65535, 0, 65535)              = 0
geteuid()                               = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
alarm(0)                                = 0
rt_sigaction(SIGALRM, {0x1, [ALRM], SA_RESTART|0x4000000}, {SIG_DFL, [], 0}, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [ALRM], [], 8) = 0
rt_sigaction(SIGALRM, {0x400874e0, [], SA_INTERRUPT|0x4000000}, {0x1, [ALRM], SA_RESTART|0x4000000}, 8) = 0
alarm(10)                               = 0
connect(3, {sa_family=AF_FILE, path="/var/run/lprng"...}, 112) = 0
rt_sigaction(SIGALRM, {0x1, [ALRM], SA_RESTART|0x4000000}, {0x400874e0, [], SA_INTERRUPT|0x4000000}, 8) = 0
alarm(0)                                = 10
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
alarm(0)                                = 0
rt_sigaction(SIGALRM, {0x1, [ALRM], SA_RESTART|0x4000000}, {0x1, [ALRM], SA_RESTART|0x4000000}, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [ALRM], [], 8) = 0
rt_sigaction(SIGALRM, {0x400874e0, [], SA_INTERRUPT|0x4000000}, {0x1, [ALRM], SA_RESTART|0x4000000}, 8) = 0
alarm(6000)                             = 0
write(3, "\2fax\n"..., 5)               = 5
rt_sigaction(SIGALRM, {0x1, [ALRM], SA_RESTART|0x4000000}, {0x400874e0, [], SA_INTERRUPT|0x4000000}, 8) = 0
alarm(0)                                = 6000
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
alarm(0)                                = 0
rt_sigaction(SIGALRM, {0x1, [ALRM], SA_RESTART|0x4000000}, {0x1, [ALRM], SA_RESTART|0x4000000}, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [ALRM], [], 8) = 0
rt_sigaction(SIGALRM, {0x400874e0, [], SA_INTERRUPT|0x4000000}, {0x1, [ALRM], SA_RESTART|0x4000000}, 8) = 0
alarm(6000)                             = 0
read(3, "\3"..., 1)                     = 1
rt_sigaction(SIGALRM, {0x1, [ALRM], SA_RESTART|0x4000000}, {0x400874e0, [], SA_INTERRUPT|0x4000000}, 8) = 0
alarm(0)                                = 6000
time(NULL)                              = 1414707900
fstat(3, {st_mode=S_IFSOCK|0777, st_size=0, ...}) = 0
shutdown(3, 1 /* send */)               = 0
time(NULL)                              = 1414707900
read(3, "spool queue for 'fax' does not ex"..., 511) = 114
read(3, ""..., 511)                     = 0
close(3)                                = 0
write(2, "Status Information:\n "..., 21Status Information:
 ) = 21
write(2, "sending job 'root@NAS-7379C5+193'"..., 435sending job 'root@NAS-7379C5+193' to fax@localhost
 connecting to 'localhost', attempt 1
 connected to 'localhost'
 requesting printer fax@localhost
 job 'root@NAS-7379C5+193' transfer to fax@localhost failed
  error 'link error 253' with ack 'ACK_FAIL'
  sending str '^Bfax' to fax@localhost
 error msg: 'spool queue for 'fax' does not exist on server NAS-7379C5'
 error msg: '   non-existent printer or you need to run 'checkpc -f''
) = 435
rt_sigprocmask(SIG_SETMASK, ~[], [], 8) = 0
close(3)                                = -1 EBADF (Bad file descriptor)
getpid()                                = 12193
exit(1)                                 = ?

Offline

 

#33 2014-10-31 01:04:13

dom323
Member
Registered: 2011-04-14
Posts: 37

Re: Using the DNS-323 as a Fax Server

I did just have a thought. It might be the path of least resistance to try to get CUPS to compile as an ffp package instead of trying to debug the firmware LPRng. Once, I have CUPS working in the ffp environment, I bet it would be easier to get the lpr command working...maybe. I'll give it another try, and see if I can get it to compile.

Offline

 

#34 2014-11-08 01:25:59

dom323
Member
Registered: 2011-04-14
Posts: 37

Re: Using the DNS-323 as a Fax Server

Just an update. I was able to get an older version of CUPS (1.7.5) to compile as an FFP package, but I haven't had the time to even try testing it yet. The more I think about it though, the more I don't think it will be this simple. Even if I get CUPS working, I'm pretty sure the Windows 'lpr' command will simply send the raw document to the NAS, and not a rendered postscript file. This means, it would be up to the NAS to render the document in preparation for faxing it, and that's not going to happen.

The new plan is to use pdfforge's PDF Creator to in conjunction with a Windows batch script. The batch script will collect the recipient's phone number, and then pass the document to PDF Creator to make a PDF version. When that's done, it will use Samba to copy the PDF to a folder on the NAS and rename the file to append the recipient's phone number to it. On the NAS, I will setup a cron job that scans the folder, sends all the waiting faxes, and then moves the PDFs to a different folder.

It's not exactly pretty, and it means spinning up the hard drives at regular intervals to check for new faxes to send. It also means that there will be a variable delay anytime someone wants to send a fax. But, I'm having trouble coming up with something better.

The receiving side of things is working pretty well. I'm surprised by the number of faxes that fail, but I'm fairly confident this is not related to my setup. I remember seeing quite a few failures on the logs from my multi-function fax machine. The trick has been to make sure the "lock" file gets deleted in all circumstances, or the modem won't be ready to receive the next fax.

Offline

 

#35 2014-11-08 15:03:59

Mijzelf
Member / Developer
Registered: 2008-07-05
Posts: 709

Re: Using the DNS-323 as a Fax Server

It's not exactly pretty, and it means spinning up the hard drives at regular intervals to check for new faxes to send.

Not necessarily. Have a look at inotify.
As I guess the files have a limited size, you could also put them on a ramdisk.

The trick has been to make sure the "lock" file gets deleted in all circumstances

Doesn't the lock get deleted all times? Who generates that lock file? faxd?

I'm pretty sure the Windows 'lpr' command will simply send the raw document to the NAS, and not a rendered postscript file.

I think you should install a generic Postscript printer on Windows, and let it print to the lpr port, or something like that. Of course it's not possible to let the printer render a raw document. That's impossible, as there are numerous document formats.

Offline

 

#36 2014-11-13 00:26:57

dom323
Member
Registered: 2011-04-14
Posts: 37

Re: Using the DNS-323 as a Fax Server

I didn't even know about inotify; that looks really cool. I'll have to try it out. Thanks for the tip.

The lock file issue is definitely a bit concerning. It looks like "efax" is responsible for generating the lock file, but in some circumstances it doesn't get removed. I haven't able to tell exactly what those circumstances are, but it definitely seems like something I shouldn't have to remove in my code. But, it does seem to work when I manually remove it, so that's a good sign.

Of course, you're right about the printer not being able to render raw documents. I don't know how I missed that simple fact in my initial plan. I still haven't had time to test any of this yet, but I will report back when I have.

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB