Open teamblubee opened 7 years ago
built with logging enabled and I got these errors:
utsushi.conf
[devices]
dev1.udi = esci:usb:04b8:0155
dev2.udi = esci:gt-s650:usb:04b8:013c
dev3.udi = sane:usb:04b8:0155
dev4.udi = sane:gt-s650:usb:04b8:013c
running gdb and getting a backtrace from the seg fault
Type "apropos word" to search for commands related to "word"...
Reading symbols from utsushi...(no debugging symbols found)...done.
(gdb) r
Starting program: /usr/local/bin/utsushi
process 68117 is executing new program: /bin/sh
process 68117 is executing new program: /usr/local/libexec/utsushi/utsushi-scan
process 68117 is executing new program: /bin/sh
process 68117 is executing new program: /usr/local/libexec/utsushi/utsushi-scan-gtkmm
2017-Oct-24 21:06:20.484126[0x80ee16000]: some device not found. delete combo::?adf=esci:usb:04b8:0155&fb=esci:gt-s650:usb:04b8:013c
2017-Oct-24 21:06:20.486145[0x80ee16000]: some device not found. delete combo::?adf=esci:usb:04b8:0156&fb=esci:gt-s650:usb:04b8:013c
2017-Oct-24 21:06:20.486476[0x80ee16000]: some device not found. delete combo::?adf=esci:usb:04b8:0157&fb=esci:gt-s650:usb:04b8:013c
2017-Oct-24 21:06:20.486789[0x80ee16000]: some device not found. delete combo::?adf=esci:usb:04b8:0155&fb=esci:gt-s650:usb:04b8:013d
2017-Oct-24 21:06:20.487096[0x80ee16000]: some device not found. delete combo::?adf=esci:usb:04b8:0156&fb=esci:gt-s650:usb:04b8:013d
2017-Oct-24 21:06:20.487425[0x80ee16000]: some device not found. delete combo::?adf=esci:usb:04b8:0157&fb=esci:gt-s650:usb:04b8:013d
2017-Oct-24 21:06:28.092281[0x80ee16000]: looking for preloaded 'esci' driver
2017-Oct-24 21:06:28.092412[0x80ee16000]: looking for 'esci' driver in '/usr/local/lib/utsushi'
2017-Oct-24 21:06:28.334757[0x80ee16000]: using '/usr/local/lib/utsushi/libdrv-esci'
Program received signal SIGSEGV, Segmentation fault.
0x00000008065a3dd4 in udev_list_entry_get_next () from /usr/local/lib/libudev.so.0
(gdb) bt
#0 0x00000008065a3dd4 in udev_list_entry_get_next () from /usr/local/lib/libudev.so.0
#1 0x00000008015ffd5f in udev_::device::device(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, unsigned short, unsigned short, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) ()
from /usr/local/lib/utsushi/libutsushi.so.0
#2 0x00000008015a4638 in utsushi::device_info::create(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) () from /usr/local/lib/utsushi/libutsushi.so.0
#3 0x0000000801b5b599 in libcnx_usb_LTX_factory () from /usr/local/lib/utsushi/libcnx-usb.so.0
#4 0x0000000801588026 in utsushi::connexion::create(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool) ()
from /usr/local/lib/utsushi/libutsushi.so.0
#5 0x000000080fb7479e in libdrv_esci_LTX_scanner_factory () from /usr/local/lib/utsushi/libdrv-esci.so
#6 0x00000008015ca228 in utsushi::scanner::create(utsushi::scanner::info const&) () from /usr/local/lib/utsushi/libutsushi.so.0
#7 0x00000008008b0ad8 in utsushi::gtkmm::chooser::create_device(std::__1::set<utsushi::scanner::info, std::__1::less<utsushi::scanner::info>, std::__1::allocator<utsushi::scanner::info> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
() from /usr/local/lib/utsushi/libutsushi-gtkmm.so.0
#8 0x00000008008b0798 in utsushi::gtkmm::chooser::on_changed() () from /usr/local/lib/utsushi/libutsushi-gtkmm.so.0
---Type <return> to continue, or q <return> to quit---
#9 0x0000000800ec1784 in Gtk::ComboBox_Class::changed_callback(_GtkComboBox*) () from /usr/local/lib/libgtkmm-2.4.so.1
#10 0x0000000804e519d3 in ?? () from /usr/local/lib/libgobject-2.0.so.0
#11 0x0000000804e66301 in g_signal_emit_valist () from /usr/local/lib/libgobject-2.0.so.0
#12 0x0000000804e66c24 in g_signal_emit () from /usr/local/lib/libgobject-2.0.so.0
#13 0x00000008032c7496 in ?? () from /usr/local/lib/libgtk-x11-2.0.so.0
#14 0x00000008032c7634 in gtk_combo_box_set_active_iter () from /usr/local/lib/libgtk-x11-2.0.so.0
#15 0x00000008032ce1fb in ?? () from /usr/local/lib/libgtk-x11-2.0.so.0
#16 0x0000000804e517eb in g_closure_invoke () from /usr/local/lib/libgobject-2.0.so.0
#17 0x0000000804e6594e in ?? () from /usr/local/lib/libgobject-2.0.so.0
#18 0x0000000804e665b6 in g_signal_emit_valist () from /usr/local/lib/libgobject-2.0.so.0
#19 0x0000000804e66c24 in g_signal_emit () from /usr/local/lib/libgobject-2.0.so.0
#20 0x00000008034792d9 in gtk_widget_activate () from /usr/local/lib/libgtk-x11-2.0.so.0
#21 0x0000000803367feb in gtk_menu_shell_activate_item () from /usr/local/lib/libgtk-x11-2.0.so.0
#22 0x0000000803368cf4 in ?? () from /usr/local/lib/libgtk-x11-2.0.so.0
#23 0x000000080335659f in _gtk_marshal_BOOLEAN__BOXED () from /usr/local/lib/libgtk-x11-2.0.so.0
#24 0x0000000804e517eb in g_closure_invoke () from /usr/local/lib/libgobject-2.0.so.0
---Type <return> to continue, or q <return> to quit---
#25 0x0000000804e65a93 in ?? () from /usr/local/lib/libgobject-2.0.so.0
#26 0x0000000804e66602 in g_signal_emit_valist () from /usr/local/lib/libgobject-2.0.so.0
#27 0x0000000804e66c24 in g_signal_emit () from /usr/local/lib/libgobject-2.0.so.0
#28 0x00000008034790f1 in ?? () from /usr/local/lib/libgtk-x11-2.0.so.0
#29 0x00000008033546d2 in gtk_propagate_event () from /usr/local/lib/libgtk-x11-2.0.so.0
#30 0x000000080335435c in gtk_main_do_event () from /usr/local/lib/libgtk-x11-2.0.so.0
#31 0x000000080388f241 in ?? () from /usr/local/lib/libgdk-x11-2.0.so.0
#32 0x00000008050d803b in g_main_context_dispatch () from /usr/local/lib/libglib-2.0.so.0
#33 0x00000008050d8364 in ?? () from /usr/local/lib/libglib-2.0.so.0
#34 0x00000008050d868f in g_main_loop_run () from /usr/local/lib/libglib-2.0.so.0
#35 0x0000000803353ccf in gtk_main () from /usr/local/lib/libgtk-x11-2.0.so.0
#36 0x0000000800eeb245 in Gtk::Main::run(Gtk::Window&) () from /usr/local/lib/libgtkmm-2.4.so.1
#37 0x00000000004066ef in ?? ()
#38 0x0000000000405e5f in ?? ()
Have any suggestions?
Let me try to summarize that a bit.
dmesg
output)04b8:08d1
)gdb
backtrace)libudev
functionlibudev
is installed in /usr/local/
, hinting that you compiled and installed it yourselfHowever, libudev
tries to communicate with a udevd
service that is normally running on Linux systems. Both are part of udev
(which itself has been included in systemd
). I have little to no experience with FreeBSD (or any other BSD) but I don't think there is a BSD port of udev
. A quick search led me to this forum post which seems to indicate I'm right about that.
If that's so, you will need to provide an alternative implementation of the device_info
interface that uses devd
(or whatever is available on FreeBSD) to obtain the information that the device_info
needs. If I were you, I'd ask around in BSD circles for a C interface to the bits and pieces device_info
needs. Come to think of it, there may be something of use in the libusb
sources as that supports OS X, NetBSD/OpenBSD.
Basically, you'd need to provide alternative implementations of lib/udev.[ch]pp
and make lib/device-info.cpp
use those when appropriate via a preprocessor macro. I can help with the lib/device-info.cpp
integration and review your code, but you will have to write the (Free)BSD versions of lib/udev.[ch]pp
(let's call them lib/bsddev.[ch]pp
).
Hi, thank you for applying my commit, I do not mind one bit.
Initially I didn't know that udev was so tightly integrated with the Linux kernel. There are some stub code in FreeBSD but not enough to make the USB drivers work and that's why I was getting some crashed.
FreeBSD has a devd system that allows communication through Unix sockets and so I started monitoring the devd socket, plugged in the USB printer/scanner Epson L360 and this comes up:
nc -U /var/run/devd.pipe
!system=DEVFS subsystem=CDEV type=CREATE cdev=usb/0.2.0
!system=DEVFS subsystem=CDEV type=CREATE cdev=ugen0.2
!system=DEVFS subsystem=CDEV type=CREATE cdev=usb/0.2.1
!system=DEVFS subsystem=CDEV type=CREATE cdev=usb/0.2.2
!system=DEVFS subsystem=CDEV type=CREATE cdev=usb/0.2.3
!system=DEVFS subsystem=CDEV type=CREATE cdev=usb/0.2.4
!system=USB subsystem=DEVICE type=ATTACH ugen=ugen0.2 cdev=ugen0.2 vendor=0x04b8 product=0x08d1 devclass=0x00 devsubclass=0x00 sernum="56474C4B3033333303" release=0x0100 mode=host port=5 parent=ugen0.1
!system=USB subsystem=INTERFACE type=ATTACH ugen=ugen0.2 cdev=ugen0.2 vendor=0x04b8 product=0x08d1 devclass=0x00 devsubclass=0x00 sernum="56474C4B3033333303" release=0x0100 mode=host interface=0 endpoints=2 intclass=0xff intsubclass=0xff intprotocol=0xff
!system=USB subsystem=INTERFACE type=ATTACH ugen=ugen0.2 cdev=ugen0.2 vendor=0x04b8 product=0x08d1 devclass=0x00 devsubclass=0x00 sernum="56474C4B3033333303" release=0x0100 mode=host interface=1 endpoints=2 intclass=0x07 intsubclass=0x01 intprotocol=0x02
? at bus=0 hubaddr=1 port=5 devaddr=2 interface=0 ugen=ugen0.2 vendor=0x04b8 product=0x08d1 devclass=0x00 devsubclass=0x00 devproto=0x00 sernum="56474C4B3033333303" release=0x0100 mode=host intclass=0xff intsubclass=0xff intprotocol=0xff on uhub0
? at bus=0 hubaddr=1 port=5 devaddr=2 interface=1 ugen=ugen0.2 vendor=0x04b8 product=0x08d1 devclass=0x00 devsubclass=0x00 devproto=0x00 sernum="56474C4B3033333303" release=0x0100 mode=host intclass=0x07 intsubclass=0x01 intprotocol=0x02 on uhub0
? at bus=0 hubaddr=1 port=5 devaddr=2 interface=0 ugen=ugen0.2 vendor=0x04b8 product=0x08d1 devclass=0x00 devsubclass=0x00 devproto=0x00 sernum="56474C4B3033333303" release=0x0100 mode=host intclass=0xff intsubclass=0xff intprotocol=0xff on uhub0
!system=DEVFS subsystem=CDEV type=CREATE cdev=ulpt0
!system=DEVFS subsystem=CDEV type=CREATE cdev=unlpt0
+ulpt0 at bus=0 hubaddr=1 port=5 devaddr=2 interface=1 ugen=ugen0.2 vendor=0x04b8 product=0x08d1 devclass=0x00 devsubclass=0x00 devproto=0x00 sernum="56474C4B3033333303" release=0x0100 mode=host intclass=0x07 intsubclass=0x01 intprotocol=0x02 on uhub0
? at bus=0 hubaddr=1 port=9 devaddr=5 interface=0 ugen=ugen0.5 vendor=0x04f2 product=0xb5a7 devclass=0xef devsubclass=0x02 devproto=0x01 sernum="" release=0x3601 mode=host intclass=0x0e intsubclass=0x01 intprotocol=0x00 on uhub0
? at bus=0 hubaddr=1 port=9 devaddr=5 interface=1 ugen=ugen0.5 vendor=0x04f2 product=0xb5a7 devclass=0xef devsubclass=0x02 devproto=0x01 sernum="" release=0x3601 mode=host intclass=0x0e intsubclass=0x02 intprotocol=0x00 on uhub0
!system=USB subsystem=DEVICE type=DETACH ugen=ugen0.2 cdev=ugen0.2 vendor=0x04b8 product=0x08d1 devclass=0x00 devsubclass=0x00 sernum="56474C4B3033333303" release=0x0100 mode=host port=5 parent=ugen0.1
!system=USB subsystem=INTERFACE type=DETACH ugen=ugen0.2 cdev=ugen0.2 vendor=0x04b8 product=0x08d1 devclass=0x00 devsubclass=0x00 sernum="56474C4B3033333303" release=0x0100 mode=host interface=0 endpoints=2 intclass=0xff intsubclass=0xff intprotocol=0xff
!system=USB subsystem=INTERFACE type=DETACH ugen=ugen0.2 cdev=ugen0.2 vendor=0x04b8 product=0x08d1 devclass=0x00 devsubclass=0x00 sernum="56474C4B3033333303" release=0x0100 mode=host interface=1 endpoints=2 intclass=0x07 intsubclass=0x01 intprotocol=0x02
!system=DEVFS subsystem=CDEV type=DESTROY cdev=ugen0.2
!system=DEVFS subsystem=CDEV type=DESTROY cdev=usb/0.2.0
!system=DEVFS subsystem=CDEV type=DESTROY cdev=ulpt0
!system=DEVFS subsystem=CDEV type=DESTROY cdev=unlpt0
-ulpt0 at on uhub0
!system=DEVFS subsystem=CDEV type=DESTROY cdev=usb/0.2.4
!system=DEVFS subsystem=CDEV type=DESTROY cdev=usb/0.2.3
!system=DEVFS subsystem=CDEV type=DESTROY cdev=usb/0.2.2
!system=DEVFS subsystem=CDEV type=DESTROY cdev=usb/0.2.1
As you can see the device is recognized, there's serial numbers and all types of information.
If this is the correct info, then I can work on updating the monitor.cpp class to use devd on FreeBSD.
This printer already prints on FreeBSD, what would be the next steps to use the information from devd to have XSane see the device?
Will I be able to work with the driver source code or can some shims be provided if not?
Apologies for the delayed response.
Given the above, I started making a stub for the code you would have to unstub but then I came across https://github.com/jiixyj/libudev-fbsd. Perhaps you could give that a try. It provides a libudev API but implements it on top of devd (and evdev IIUC).
That looks interesting but I'd prefer to write the code based on devd since that would be easier to maintain in the long run.
The output above showed what information devd provides when the device is plugged in. What stub code were you going to write? I can provide the implementation in a way that shouldn't change on this side.
I made a few edits see PR: https://github.com/utsushi/utsushi/pull/35
The issue now is that utsushi still doesn't see the attached device even though it shows up in dmesg
running ldd on the binary returns these results
I build the program and these are the libs that it installed
Maybe some files are missing, could you assist?