Precise 571JPにCanonのインクジェットプリンタiP4300をUSB接続しています。
Canonから提供されているプリンタドライバおよびインク残量を確認するステータスモニタなどを
下記手順にて動作させることができました。
0.ソースのコンパイルを行うため、devx_precise_5.7.1.sfsをロードしておく。
1.CanonのサイトからiP4300のドライバソースファイルをダウンロード
http://cweb.canon.jp/drv-upd/ij-sfp/bjl ... p4300.html
・IJ Printer Driver Ver.2.70 for Linux ソースファイル
(cnijfilter-common-2.70-2.src.rpm)
2.コンパイルに必要なパッケージを下記サイトよりダウンロード・インストールする。
・libgtk1.2
http://archive.debian.net/etch/libgtk1.2
(libgtk1.2_1.2.10-18_i386.deb)
・libgtk1.2-dev
http://archive.debian.net/etch/libgtk1.2-dev
(libgtk1.2-dev_1.2.10-18_i386.deb)
・libglib1.2
http://archive.debian.net/etch/libglib1.2
(libglib1.2_1.2.10-17_i386.deb)
・libglib1.2-dev
http://archive.debian.net/etch/libglib1.2-dev
(libglib1.2-dev_1.2.10-17_i386.deb)
・libxml
http://archive.debian.net/etch/i386/libxml1
(libxml1_1.8.17-14+etch1_i386.deb)
・libxml-dev
http://archive.debian.net/etch/libxml-dev
(libxml-dev_1.8.17-14+etch1_i386.deb)
3.プリンタドライバのソースファイル(rpm形式)を展開。
# rpm2cpio cnijfilter-common-2.70-2.src.rpm | cpio -i
# tar zxvf cnijfilter-common-2.70-2.tar.gz
4.ステータスモニタのソースを修正
下記サイトを参考に、cnijfilter-common-2.70/cngpijmon/src/bjcupsmon_cups.cを修正。
(サイト内1.のbjcupsmon_common.hの修正は不要)
http://forums.opensuse.org/showthread.p ... r-CUPS-1-4
5.autogen.shの実行
cnijfilter-common-2.70内の各ディレクトリにてautogen.shを実行
# cd libs
# ./autogen.sh
# cd ../cngpij
# ./autogen.sh
# cd ../pstocanonij
# ./autogen.sh --prefix=/usr
# cd ../ppd
# ./autogen.sh --prefix=/usr
# cd ../cnijfilter
# ./autogen.sh --enable-libpath=/usr/lib/bjlib --program-suffix=ip4300
# cd ../printui
# ./autogen.sh --datadir=/usr/local/share --program-suffix=ip4300
# cd ../lgmon
# ./autogen.sh --program-suffix=ip4300
# cd ../cngpijmon
# ./autogen.sh --datadir=/usr/local/share --program-suffix=ip4300
# cd ..
6.cnijfilter-common-2.70ディレクトリ内のMakefileの修正、およびmakeの実行
cnijfilter-common-2.70/Makefileを以下のように修正。
--------------------------------------------------------------------------------------------
#dirs = libs cngpij cngpijmon ppd pstocanonij
#dirs = libs cngpij ppd pstocanonij
dirs = libs cngpij cngpijmon ppd pstocanonij cnijfilter lgmon printui
PR_ID = 294
libdir = /usr/lib
scripts=for dir in $(dirs); do\
(cd $$dir; make $$target)|| exit 1;\
done
all :
$(scripts)
clean :
target=clean; $(scripts)
install :
target=install; $(scripts)
mkdir -p $(libdir)/bjlib
install -c -m 755 $(PR_ID)/database/* $(libdir)/bjlib
cp -P $(PR_ID)/libs_bin/* $(libdir)
chmod 755 $(PR_ID)/libs_bin/*
--------------------------------------------------------------------------------------------
修正後、make、make installを実行
# make
# make install
7.プリンタの電源をONにし、下記コマンドを実行してプリンタを登録する。
# lpadmin -p iP4300 -m canonip4300.ppd -v usb:/dev/usb/lp0 -E
# lpadmin -d iP4300
# /etc/init.d/cups restart
8.printers.confの修正
/etc/cups/printers.confを開き、iP4300のDevice URIを修正する。
DeviceURI usb:/dev/usb/lp0 → DeviceURI cnij_usb:/dev/usb/lp0
9.このままだとcngpijmonやcngpijの画面が文字化けするため、下記サイトを参考にgtkrcファイルを作成。
http://blog.livedoor.jp/shobondama/arch ... 11114.html
以下、gtkrcファイルの内容
--------------------------------------------------------------------------------------------
style "gtk-default-ja-utf8" {
fontset = "-adobe-helvetica-medium-r-normal--14-100-100-100-p-76-iso8859-1,\
-ricoh-ms mincho-medium-r-normal--14-*-*-*-*-*-jisx0208.1983-0,\
-misc-fixed-medium-r-normal--14-*-*-*-*-*-jisx0208.1983-0,\
*-r-*"
}
class "GtkWidget" style "gtk-default-ja-utf8"
--------------------------------------------------------------------------------------------
参考サイトでは、/etc/gtk/gtkrc.ja.utf-8として作成されていますが、
今回は/rootの直下に、.gtkrc というファイル名で保存(/root/.gtkrc)しました。
10.k14フォントのインストール
下記サイトを開き、[plain text]のリンクを右クリック→リンク先のコンテンツを保存(Operaの場合)。
http://www.opensource.apple.com/source/ ... .2/k14.bdf
/rootディレクトリ内に.fontsディレクトリを作成し、ダウンロードしたk14.bdfをそこに移動。
# mkdir /root/.fonts
# mv k14.bdf /root/.fonts/
# mkfontdir /root/.fonts
11.OS再起動(XのリスタートでもOK)すると、ステータスモニタなどがきちんと使えるようになります。
Canon iP4300 インクジェットプリンタ
Re: Canon iP4300 インクジェットプリンタ
前の投稿の「4.ステータスモニタのソースを修正」と「6.cnijfilter-common-2.70ディレクトリ内のMakefileの修正、およびmakeの実行」についてdiffをとりました。ご参考にどうぞ。
「4.ステータスモニタのソースを修正」のdiff
#diff -u bjcupsmon_cups.c.orig bjcupsmon_cups.c
「6.cnijfilter-common-2.70ディレクトリ内のMakefileの修正、およびmakeの実行」
# diff -u Makefile.orig Makefle
※上記Makefileの行頭のタブがスペースに置き換わっているかもしれません。
pacthを当てたりする場合はタブに戻してください。
「4.ステータスモニタのソースを修正」のdiff
#diff -u bjcupsmon_cups.c.orig bjcupsmon_cups.c
コード: 全て選択
--- bjcupsmon_cups.c.orig 2006-11-24 20:04:41.000000000 +0900
+++ bjcupsmon_cups.c 2014-04-29 01:34:16.000000000 +0900
@@ -389,6 +389,88 @@
return(retVal);
}// End removeJob
+PRIVATE gchar * getJobState(gchar *pDestName, gchar *pURI, gchar *pServerName, ipp_jstate_t *pJobState, gchar *pJobUserName)
+{
+/*** Parameters start ***/
+ http_t *pHTTP; // Pointer to HTTP connection.
+ ipp_t *pRequest, // Pointer to CUPS IPP request.
+ *pResponse; // Pointer to CUPS IPP response.
+ ipp_attribute_t *pAttribute; // Pointer to CUPS attributes.
+ cups_lang_t *pLanguage; // Pointer to language.
+// ipp_jstate_t jobState = 0; // Job state.
+// gint jobID = 0; // Job ID.
+// gchar *pJobUserName = NULL; // User name of print job.
+ uid_t userID; // User ID.
+ struct passwd *pPasswd; // Pointer to password structure.
+ gint retVal = ID_ERR_PRINT_JOB_NOT_EXIST; // Return value.
+/*** Parameters end ***/
+
+ // Get login name.
+ userID = getuid();
+ pPasswd = getpwuid(userID);
+
+ // CUPS http connect.
+ if ((pHTTP = httpConnectEncrypt(pServerName, ippPort(), cupsEncryption())) == NULL) {
+ retVal = ID_ERR_CUPS_API_FAILED;
+ }
+ else {
+ pRequest = ippNew();
+
+ pRequest->request.op.operation_id = IPP_GET_JOB_ATTRIBUTES;
+ pRequest->request.op.request_id = 1;
+
+ pLanguage = bjcupsLangDefault(); // cupsLangDefault() -> bjcupsLangDefault() for cups-1.1.19
+
+ ippAddString(pRequest, IPP_TAG_OPERATION, IPP_TAG_CHARSET, "attributes-charset", NULL, cupsLangEncoding(pLanguage));
+ ippAddString(pRequest, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, "attributes-natural-language", NULL, pLanguage->language);
+ ippAddString(pRequest, IPP_TAG_OPERATION, IPP_TAG_URI, "job-uri", NULL, pURI);
+
+ if ((pResponse = cupsDoRequest(pHTTP, pRequest, "/")) != NULL) {
+ if (pResponse->request.status.status_code > IPP_OK_CONFLICT) {
+ retVal = ID_ERR_CUPS_API_FAILED;
+ }
+ else {
+ pAttribute = pResponse->attrs;
+
+ while (pAttribute != NULL) {
+ while (pAttribute != NULL && pAttribute->group_tag != IPP_TAG_JOB) {
+ pAttribute = pAttribute->next;
+ }
+ if (pAttribute == NULL) {
+ break;
+ }
+
+ while (pAttribute != NULL && pAttribute->group_tag == IPP_TAG_JOB) {
+ if (strcmp(pAttribute->name, "job-state") == 0 && pAttribute->value_tag == IPP_TAG_ENUM) {
+ *pJobState = (ipp_jstate_t)pAttribute->values[0].integer;
+ }
+ if (strcmp(pAttribute->name, "job-originating-user-name") == 0 && pAttribute->value_tag == IPP_TAG_NAME) {
+ //pJobUserName = pAttribute->values[0].string.text;
+ pJobUserName=malloc(20*sizeof(gchar));
+ strncpy(pJobUserName,pAttribute->values[0].string.text,19);
+ pJobUserName[19]='\0';
+
+ }
+ pAttribute = pAttribute->next;
+ }
+ if (pAttribute != NULL)
+ pAttribute = pAttribute->next;
+ }
+ }
+
+ ippDelete(pResponse);
+ }
+ else {
+ retVal = ID_ERR_CUPS_API_FAILED;
+ }
+
+ cupsLangFree(pLanguage);
+ httpClose(pHTTP);
+ }
+
+
+ return(pJobUserName);
+}// End getJobID
///////////////////////////////////////////////////////////////////////////////////////////
//
@@ -452,14 +534,20 @@
}
while (pAttribute != NULL && pAttribute->group_tag == IPP_TAG_JOB) {
+// if (strcmp(pAttribute->name, "job-id") == 0 && pAttribute->value_tag == IPP_TAG_INTEGER) {
+// jobID = pAttribute->values[0].integer;
+// }
+// if (strcmp(pAttribute->name, "job-state") == 0 && pAttribute->value_tag == IPP_TAG_ENUM) {
+// jobState = (ipp_jstate_t)pAttribute->values[0].integer;
+// }
+// if (strcmp(pAttribute->name, "job-originating-user-name") == 0 && pAttribute->value_tag == IPP_TAG_NAME) {
+// pJobUserName = pAttribute->values[0].string.text;
+// }
if (strcmp(pAttribute->name, "job-id") == 0 && pAttribute->value_tag == IPP_TAG_INTEGER) {
jobID = pAttribute->values[0].integer;
}
- if (strcmp(pAttribute->name, "job-state") == 0 && pAttribute->value_tag == IPP_TAG_ENUM) {
- jobState = (ipp_jstate_t)pAttribute->values[0].integer;
- }
- if (strcmp(pAttribute->name, "job-originating-user-name") == 0 && pAttribute->value_tag == IPP_TAG_NAME) {
- pJobUserName = pAttribute->values[0].string.text;
+ if (strcmp(pAttribute->name, "job-uri") == 0 && pAttribute->value_tag == IPP_TAG_URI) {
+ pJobUserName=getJobState(pDestName,pAttribute->values[0].string.text,pServerName,&jobState,pJobUserName);
}
pAttribute = pAttribute->next;
}
# diff -u Makefile.orig Makefle
コード: 全て選択
--- Makefile.orig 2006-10-30 21:01:43.000000000 +0900
+++ Makefile 2014-05-18 21:42:10.927336136 +0900
@@ -1,5 +1,8 @@
#dirs = libs cngpij cngpijmon ppd pstocanonij
-dirs = libs cngpij ppd pstocanonij
+#dirs = libs cngpij ppd pstocanonij
+dirs = libs cngpij cngpijmon ppd pstocanonij cnijfilter lgmon printui
+PR_ID = 294
+libdir = /usr/lib
scripts=for dir in $(dirs); do\
(cd $$dir; make $$target)|| exit 1;\
@@ -13,4 +16,8 @@
install :
target=install; $(scripts)
+ mkdir -p $(libdir)/bjlib
+ install -c -m 755 $(PR_ID)/database/* $(libdir)/bjlib
+ cp -P $(PR_ID)/libs_bin/* $(libdir)
+ chmod 755 $(PR_ID)/libs_bin/*
pacthを当てたりする場合はタブに戻してください。