免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 4933 | 回复: 4
打印 上一主题 下一主题

ARM9+linux上使用efax成功实现modem发送传真 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-11-28 10:53 |只看该作者 |倒序浏览
之前认真学习过三类传真机收发传真过程,也分析了mgetty-1.1.36(主要在PC上用的)与远端传真机建立连接的部分源码.最后也写了个发送传真的程序。可是到phaseC,modem给远端传真机发送TCF帧后,总不能接受到信号。后来找到了efax这个开源传真软件,efax比mgetty更小巧,使用起来也比较灵活,下面是在ARM9+linux2.6.12上使用modem来发送传真的过程。

1, 交叉编译efax,这个过程非常简单:
                       源代码下载地址:http://www.cce.com/efax/download/
这里有他的pdf使用说明文档: http://www.cce.com/efax/documentation/


      解压缩下载源代码包:  #tar -xzf efax-0.9.tar.gz  -C /usr/local/src
     
      修改Makefile:     
     CC=arm-linux-uclibc-gcc
     STRIP=arm-linux-uclibc-strip
     并将strip efax  改为 $(STRIP) efax

     #make  

make之后会生成两个文件,efax和efix.  其中efax是用来收发传真的代码,而efix是将我们的普通文件转换成相应的传真文件。源码包里的fax文件是一个shell脚本,主要在这个shell脚本里完成一些传真配置。

2,修改fax这个shell脚本:
< FAX=/tmp/fax        //这里指定fax, efax, efix的path,注意该目录需可写,因为他要写log.当然可以修改源码
< EFAX=/tmp/efax
< EFIX=/tmp/efix
---
> FAX=fax
> EFAX=efax
> EFIX=efix
31c31
< DEV=ttyS4    //这里指定我的modem所在的设备名,我的modem比较多,用的是ttyS4
---
> DEV=cua1

3, 发传真,其中test是我要发的文件,628是传真号码。(我们内部电话只需要拨分机号就OK了)
>: ./fax send -l -v 628 test
./fax: ./fax: 1038: make: not found
test is text...
/tmp/efax: 29:10 efax v 0.9 Copyright 1999 Ed Casas
efax: 29:10 TIFF version 4.2 file (little-endian)
efax: 29:10 TIFF directory at 8 with 17 tags, last image.
efax: 29:10 page 1 : test.001 + 234 : 1728x1078 @ 0x0 dpi TIFF/FAX
efax: 29:10 argv[0]=/tmp/efax
efax: 29:10 argv[1]=-v
efax: 29:10 argv[2]=chewmainrxtf
efax: 29:10 argv[3]=-v
efax: 29:10 argv[4]=chewmainrxtf
efax: 29:10 argv[5]=-d/dev/ttyS4
efax: 29:10 argv[6]=-x
efax: 29:10 argv[7]=/var/lock/LCK..ttyS4
efax: 29:10 argv[8]=-iZ
efax: 29:10 argv[9]=-i&FE&D2S7=120
efax: 29:10 argv[10]=-i&C0
efax: 29:10 argv[11]=-iM1L0
efax: 29:10 argv[12]=-l
efax: 29:10 argv[13]=+1 800 555 5555
efax: 29:10 argv[14]=-kZ
efax: 29:10 argv[15]=-h
efax: 29:10 argv[16]=1927/09/19 04:29 +1 800 555 5555 Put Your Name Here p. %d/%d
efax: 29:10 argv[17]=-t
efax: 29:10 argv[18]=T628
efax: 29:10 argv[19]=test.001
efax: 29:10 created text lock file /var/lock/LCK..ttyS4
efax: 29:10 opened /dev/ttyS4
efax: 29:10 ======================= command  "ATQ0V1" +++++++++++++++++++++
efax: 29:10 waiting 2 s
efax: 29:10 .592 [ATQ0V1<CR><CR><LF>]
efax: 29:10 .632 [OK<CR><LF>]
efax: 29:10 response "OK"
efax: 29:10 ======================= command  "ATZ" +++++++++++++++++++++
efax: 29:10 waiting 5 s
efax: 29:10 .742 [ATZ<CR><CR><LF>]
efax: 29:10 .802 [OK<CR><LF>]
efax: 29:10 response "OK"
efax: 29:10 ======================= command  "AT&FE&D2S7=120" +++++++++++++++++++++
efax: 29:10 waiting 5 s
efax: 29:10 .912 [AT&FE&D2S7=120<CR><CR><LF>]
efax: 29:10 .952 [OK<CR><LF>]
efax: 29:10 response "OK"
efax: 29:11 ======================= command  "AT&C0" +++++++++++++++++++++
efax: 29:11 waiting 5 s
efax: 29:11 .092 [<CR><LF>OK<CR><LF>]
efax: 29:11 response "OK"
efax: 29:11 ======================= command  "ATM1L0" +++++++++++++++++++++
efax: 29:11 waiting 5 s
efax: 29:11 .242 [<CR><LF>OK<CR><LF>]
efax: 29:11 response "OK"
efax: 29:11 ======================= command  "ATE0" +++++++++++++++++++++
efax: 29:11 waiting 5 s
efax: 29:11 .392 [<CR><LF>OK<CR><LF>]
efax: 29:11 response "OK"
efax: 29:11 ======================= command  "ATI3" +++++++++++++++++++++
efax: 29:11 waiting 5 s
efax: 29:11 .542 [<CR><LF>CX93001-EIS_V0.2002-V92<CR><LF>]
efax: 29:11 .563 [<CR><LF>OK<CR><LF>]
efax: 29:11 response "OK"
efax: 29:11 ======================= command  "AT+FCLASS=?" +++++++++++++++++++++
efax: 29:11 waiting 5 s
efax: 29:11 .713 [<CR><LF>0,1,1.0,8<CR><LF>]
efax: 29:11 .714 [<CR><LF>OK<CR><LF>]
efax: 29:11 response "OK"
efax: 29:11 ======================= command  "AT+FCLASS=1" +++++++++++++++++++++
efax: 29:11 waiting 5 s
efax: 29:11 .873 [<CR><LF>OK<CR><LF>]
efax: 29:11 response "OK"
efax: 29:11 using CX93001-EIS_V0.2002-V92 in class 1
efax: 29:11 ======================= command  "AT+FTM=?" +++++++++++++++++++++
efax: 29:11 waiting 5 s
efax: 29:11 .983 [<CR><LF>3,24,48,72,73,74,96,97,98,121,122,145,146<CR><LF>]
efax: 29:12 .013 [<CR><LF>OK<CR><LF>]
efax: 29:12 response "OK"
efax: 29:12 dialing T628
efax: 29:12 ======================= command  "ATDT628" +++++++++++++++++++++
efax: 29:12 waiting 120 s
efax: 29:23 .084 [<CR><LF>CONNECT<CR><LF>]
efax: 29:23 response "CONNECT"
efax: 29:23 connected
efax: 29:25 waiting 2 s
efax: 29:25 .426 [<CR><LF>OK<CR><LF>]
efax: 29:25 response "OK"
efax: 29:25 Warning: bit-reversed HDLC frame, reversing bit order
efax: 29:25 received 16 bytes:
efax: 29:25  ff c0 04 00 00 6a aa aa 00 31 09 01 1e b0 db 93
efax: 29:25 received NSF - answering features
efax: 29:25 ======================= command  "AT+FRH=3" +++++++++++++++++++++
efax: 29:25 waiting 35 s
efax: 29:25 .456 [<CR><LF>CONNECT<CR><LF>]
efax: 29:25 response "CONNECT"
efax: 29:25 waiting 2 s
efax: 29:25 .466 [<CR><LF>OK<CR><LF>]
efax: 29:25 response "OK"
efax: 29:25 received 25 bytes:
efax: 29:25  ff c0 02 4c 0c ec 0c cc ec 9c ac ec 4c 0c 04 04
efax: 29:25  04 04 04 04 04 04 04 bd 26
efax: 29:25 received CSI - answering ID
efax: 29:25 remote ID ->            02759730702
efax: 29:25 ======================= command  "AT+FRH=3" +++++++++++++++++++++
efax: 29:25 waiting 35 s
efax: 29:25 .496 [<CR><LF>CONNECT<CR><LF>]
efax: 29:25 response "CONNECT"
efax: 29:25 waiting 2 s
efax: 29:25 .506 [<CR><LF>OK<CR><LF>]
efax: 29:25 response "OK"
efax: 29:25 received 11 bytes:
efax: 29:25  ff c8 01 00 77 15 23 01 88 e7 cd
efax: 29:25 received DIS - answering capabilities
efax: 29:25 remote has no document(s) to send, and can receive
efax: 29:25 local      98lpi 14.4kbps 8.5"/215mm  any     1D      -       -  0ms
efax: 29:25 remote  196lpi 14.4kbps 8.5"/215mm  any     2D ECM-64     -  10ms
efax: 29:25 session  98lpi 14.4kbps 8.5"/215mm  any     1D      -       -  10ms
efax: 29:25 ======================= command  "AT+FTH=3" +++++++++++++++++++++
efax: 29:25 waiting 3 s
efax: 29:25 .546 [<CR><LF>CONNECT<CR><LF>]
efax: 29:25 response "CONNECT"
efax: 29:25 sent 23 bytes:
efax: 29:25  ff c0 c2 ac ac ac ac 04 ac ac ac 04 0c 0c 1c 04
efax: 29:25  8c d4 04 04 04 04 04
efax: 29:25 sent TSI - caller ID
efax: 29:25 waiting 13 s
efax: 29:26 .817 [<CR><LF>CONNECT<CR><LF>]
efax: 29:26 response "CONNECT"
efax: 29:26 sent 6 bytes: ff c8 c1 00 44 14
efax: 29:26 sent DCS - session format
efax: 29:26 waiting 13 s
efax: 29:27 .698 [<CR><LF>OK<CR><LF>]
efax: 29:27 response "OK"
efax: 29:27 ======================= command  "AT+FTS=8" +++++++++++++++++++++
efax: 29:27 waiting 3 s
efax: 29:27 .798 [<CR><LF>OK<CR><LF>]
efax: 29:27 response "OK"
efax: 29:27 ======================= command  "AT+FTM=145" +++++++++++++++++++++
efax: 29:27 waiting 3 s
efax: 29:27 .838 [<CR><LF>CONNECT<CR><LF>]
efax: 29:27 response "CONNECT"
efax: 29:30 waiting 30 s
efax: 29:30 .941 [<CR><LF>OK<CR><LF>]
efax: 29:30 response "OK"
efax: 29:30 sent TCF - channel check of 2700 bytes
efax: 29:30 ======================= command  "AT+FRS=1" +++++++++++++++++++++
efax: 29:30 waiting 3 s
efax: 29:31 .021 [<CR><LF>OK<CR><LF>]
efax: 29:31 response "OK"
efax: 29:31 ======================= command  "AT+FRH=3" +++++++++++++++++++++
efax: 29:31 waiting 3 s
efax: 29:31 .512 [<CR><LF>CONNECT<CR><LF>]
efax: 29:31 response "CONNECT"
efax: 29:32 waiting 2 s
efax: 29:32 .503 [<CR><LF>OK<CR><LF>]
efax: 29:32 response "OK"
efax: 29:32 received 5 bytes: ff c8 21 57 be
efax: 29:32 received CFR - channel OK
efax: 29:32 ======================= command  "AT+FTM=146" +++++++++++++++++++++
efax: 29:32 waiting 3 s
efax: 29:32 .543 [<CR><LF>CONNECT<CR><LF>]
efax: 29:32 response "CONNECT"
efax: 29:32 padding to 18 bytes/scan line.
efax: 29:32 header:[1927/09/19 04:29 +1 800 555 5555 Put Your Name Here p. 1/1]
efax: 29:42 waiting 30 s
efax: 29:44 .224 [<CR><LF>OK<CR><LF>]

efax: 29:44 response "OK"
efax: 29:44 sent 20+1064 lines, 4445+15949 bytes, 12 s  13596 bps
efax: 29:44 ======================= command  "AT+FTS=8" +++++++++++++++++++++
efax: 29:44 waiting 3 s
efax: 29:44 .324 [<CR><LF>OK<CR><LF>]
efax: 29:44 response "OK"
efax: 29:44 ======================= command  "AT+FTH=3" +++++++++++++++++++++
efax: 29:44 waiting 3 s
efax: 29:44 .374 [<CR><LF>CONNECT<CR><LF>]
efax: 29:44 response "CONNECT"
efax: 29:44 sent 3 bytes: ff c8 f4
efax: 29:44 sent EOP - done
efax: 29:44 waiting 13 s
efax: 29:45 .696 [<CR><LF>OK<CR><LF>]
efax: 29:45 response "OK"
efax: 29:45 ======================= command  "AT+FRH=3" +++++++++++++++++++++
efax: 29:45 waiting 3 s
efax: 29:46 .146 [<CR><LF>CONNECT<CR><LF>]
efax: 29:46 response "CONNECT"
efax: 29:47 waiting 2 s
efax: 29:47 .148 [<CR><LF>OK<CR><LF>]
efax: 29:47 response "OK"
efax: 29:47 received 5 bytes: ff c8 31 45 8f
efax: 29:47 received MCF - page OK
efax: 29:47 sent -> test.001
efax: 29:47 ======================= command  "AT+FTH=3" +++++++++++++++++++++
efax: 29:47 waiting 3 s
efax: 29:47 .187 [<CR><LF>CONNECT<CR><LF>]
efax: 29:47 response "CONNECT"
efax: 29:47 sent 3 bytes: ff c8 5f
efax: 29:47 sent DCN - disconnect
efax: 29:47 waiting 13 s
efax: 29:48 .509 [<CR><LF>OK<CR><LF>]
efax: 29:48 response "OK"
efax: 29:48 ======================= command  "ATH" +++++++++++++++++++++
efax: 29:48 waiting 5 s
efax: 29:49 .079 [<CR><LF>OK<CR><LF>]
efax: 29:49 response "OK"
efax: 29:49 ======================= command  "ATQ0V1" +++++++++++++++++++++
efax: 29:49 waiting 2 s
efax: 29:49 .189 [<CR><LF>OK<CR><LF>]
efax: 29:49 response "OK"
efax: 29:49 ======================= command  "ATZ" +++++++++++++++++++++
efax: 29:49 waiting 5 s
efax: 29:49 .329 [<CR><LF>OK<CR><LF>]
efax: 29:49 response "OK"
efax: 29:49 read HDB pid 951 [         951<LF>] from /var/lock/LCK..ttyS4 (our pid)
efax: 29:49 removed lock file /var/lock/LCK..ttyS4
efax: 29:49 done, returning 0 (success)

论坛徽章:
0
2 [报告]
发表于 2008-11-28 11:18 |只看该作者
dglwx兄一发就是经典呀,PFPF

论坛徽章:
0
3 [报告]
发表于 2008-12-25 22:20 |只看该作者
呵呵,我也在2410上做成过
可以通过网络接收,然后通过modem发传真出去,收到后再通过网络发到PC上

论坛徽章:
3
金牛座
日期:2014-06-14 22:04:062015年辞旧岁徽章
日期:2015-03-03 16:54:152015年迎新春徽章
日期:2015-03-04 09:49:45
4 [报告]
发表于 2008-12-25 22:36 |只看该作者
不错,看到at指令,好熟悉的感觉啊

论坛徽章:
0
5 [报告]
发表于 2008-12-26 08:20 |只看该作者


用ARM发传真,学习了
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP