Skip to main content

ปัญหา SCANNER บนระบบ UBUNTU

Scanner + Ubuntu
สิ่งที่เจอคือ เครื่องปริ้นเตอร์ใหม่ๆจะมีเครื่องสแกนเนอร์ติดมาด้วย แต่เมื่อจะใช้งานผ่านโปรแกรม Simple scan หรือ Xsane กลับแจ้ง error
หรือแบบนี้
ทั้งที่เครื่องเดียวกันนี้สามารถสั่งพิมพ์งานได้
จากข้อความแจ้งว่า ไม่สามารถเชื่อมต่ออุปกรณ์ หรือ ไม่สามารถเปิดอุปกรณ์ที่กำหนด ที่ "brother4:bus2;dev4" ก็ไปดูกันก่อนว่าแล้วเครื่องเรามีอะไรอยู่

1. ใช้คำสั่ง scanimage -L เพื่อดูว่าเรามีเครื่องสแกนเนอร์ที่ลงทะเบียนไว้อะไรบ้าง

user1@Aclient:#scanimage -L หรือ scanimage --list-devices
device `brother4:bus2;dev4' is a Brother DCP-T300 USB scanner

2. คำสั่ง  sane-find-scanner เพื่อยืนยันอุปกรณ์ แบรนด์  รุ่น ฟอร์ตเชื่อมต่อ

user1@Aclient:/home/user1# sane-find-scanner
found USB scanner (vendor=0x04f9 [Brother], product=0x0393 [DCP-T300]) at libusb:003:002

3. ต่อไป ใช้คำสั่ง lsusb  เพื่อดูว่ามีอุปกรณ์ Brother ใช้งาน usb ไหนกันแน่

root@Aclient:# lsusb | grep Brother
Bus 003 Device 002: ID 04f9:0393 Brother Industries, Ltd


แสดงว่า PORT USB มีอุปกรณ์Brother Scanner  id 04F9 เชื่อมต่ออยู่
**จุดสังเกต Brother Industries, Ltd หมายถึงชื่อบริษัท ไม่ได้เจาะจงว่าเป็นเครื่องปริ้นหรือเครื่องสแกน เพียงบอกว่าอุปกรณ์ของบริษัทนี้เชื่อมต่อฟอร์ตUSBใดเท่านั้น

สังเกตว่าจาก2ชุดคำสั่ง แสดงตำแหน่ง bus/dev ไม่ตรงกัน
bus2;dev4
libusb:003:002

3. ลองไปดูใน dmesg | grep Brother

root@Aclient:#dmesg | grep Brother
usb 3-1: usbfs: interface 0 claimed by usblp while 'scanimage' sets config #1
usb 3-1: Manufacturer: Brother


4. ให้ลองทดสอบโดยใช้คำสั่ง scanimage --format=PNG > test.png บน command line ดูโดยยังเป็นสิทธิ์ผู้ใช้ธรรมดา

user1@Aclient:# scanimage --format=PNG > test.png
scanimage: open of device brother4:bus2;dev4 failed: Invalid argument


ซึ่ง error จะเหมือนกับตอนเรียกโปรแกรม Xsane

5. ต่อไปให้ลองเปลี่ยนเป็น root ด้วยคำสั่ง sudo su แล้วลองสั่งสแกนอีกครั้งด้วยชุดคำสั่งเดิม

root@Aclient:# scanimage --format=PNG > test.png
scanimage: rounded value of br-x from 215.9 to 215.88
scanimage: rounded value of br-y from 355.6 to 355.567
 
root@Aclient:#

แปลว่าตอนเป็น userธรรมดา ใช้ไม่ได้ แต่เมื่อเป็น root กลับใช้ได้???


6. เราก็ไปสั่งให้โปรแกรม SANE รู้จักอุปกรณ์ โดยใช้สิทธิ์ผู้ดูแล
     6.1. เปิดไฟล์  /lib/udev/rules.d/40-libsane.rules   ถ้าไม่มีก็สร้างใหม่เลย
     6.2. ใส่ข้อความ2บรรทัดนี้ไปต่อท้ายในไฟล์

# Brother scanners
ATTRS{idVendor}=="04f9", ENV{libsane_matched}="yes"


     6.3. บันทึก แล้วสั่ง REBOOT เครื่อง
     6.4. ทดลองเรียกโปรแกรม Simple-scan หรือ Xsane อีกครั้ง


Refer:
1. https://www.linuxquestions.org/questions/linuxquestions-org-member-success-stories-23/brother-scanner-mfc-665cw-xsane-would-say-failed-to-open-device-invalid-argument-4175648482/
2. https://ubuntuforums.org/showthread.php?t=1424291&p=9921396#post9921396
3. https://wiki.archlinux.org/index.php/SANE/Scanner-specific_problems#Brother

Comments