From: Raphael L. <rap...@gm...> - 2004-11-16 19:16:16
|
On Tuesday 16 November 2004 18:18, Raphael Langerhorst wrote: > On Tuesday 16 November 2004 17:39, Raphael Langerhorst wrote: > > Hi all, > > > > I'm currently tracking down the issue that causes hpoj to fail > > with PSC devices connected on USB on FreeBSD. > > > > If anyone has some hints what could make it fail, let me know. > > > > configuration: > > FreeBSD 5.3 RELEASE, libusb 0.1.7, hpoj of 16th Nov 2004, PSC > > 1210 32 Bit Athlon CPU, I'm using a 4 port PCI card for USB 2.0 > > (to which the device is attached) > > The device gets identified at /dev/ugen0 but "communication" > > fails > > > > (see previous emails for details) > > > > Thanks, > > Raphael > > Hello again, > > First I wrote a little test application to see whether I can open > an usb device twice without closing it in between. It turned out > that I could open /dev/ugen0 (my PSC 1210) the first time but it > failed for the second time. It succeeded again if I closed the > device in between. -> You can open an usb device only once or you > have to close it before reopening (keep that in mind, see below). > > I added some debugging code to bsd.c for the libusb library that > tells me when a device gets opened and when a device gets closed. > Then I removed the "> /dev/null" from the system call of the > ptal-init script to see the output of the mlcd call: > > Probe for USB-connected devices ([y]/n)? y > > Probing "%/dev/usb2%/dev/ugen0"... usb_os_open called on > /dev/ugen0 usb_os_close called on /dev/ugen0 > usb_os_open called on /dev/ugen0 > usb_os_close called on /dev/ugen0 > usb_os_open called on /dev/ugen0 > usb_os_open called on /dev/ugen0 > > ptal-mlcd: ERROR at ExMgr.cpp:3752, > dev=<mlc:usb:probe@%/dev/usb2%/dev/ugen0>, p > id=4251, e=16, t=1100624870 > usb_open failed! > > ptal-mlcd: ERROR at ExMgr.cpp:2572, > dev=<mlc:usb:probe@%/dev/usb2%/dev/ugen0>, p > id=4251, e=16, t=1100624870 > Couldn't set up print interface! > usb_os_close called on /dev/ugen0 > > *** Found "psc 1200 series" but failed to communicate with it! > *** Elapsed time for this attempt was 0 second(s). > *** Check syslog file for ptal-mlcd error messages. > *** See hpoj documentation for troubleshooting information. > > ------------------------------------------------------------------- >--- > > > The "usb_os_open" and "usb_os_close" lines is the debugging code I > put into my libusb. As you can see hpoj tries to close, open, > close, open, open the device which of course causes it to fail -> > that's why ptal tells me that usb_open failed! > > Ok now, why does hpoj need to open the usb device twice??? I'll > have a look into that myself, but if this already helps to shoot > the bug in hpoj then let me know (I don't know the source code as > well as the authors). > > > Regards, > Raphael Ok, I have scanning OR printing working :) But this is NOT a final solution(!!) only better than nothing. Attached is a patch that makes it possible to use a HP PSC1210 attached to USB work with FreeBSD 5.3 (with hpoj of course). I used a CVS snapshot of today. If you use the patch then you can print if: * you have the ulpt module loaded (kldload ulpt). You do not need to start hpoj as the PSC is identified as an USB printer and connected as such at /dev/ulpt0 (or /dev/ulpt1, ...) or you can scan if you have the module NOT loaded (you probably have to remove "device ulpt" from your kernel configuration). Then you can use "ptal-init setup" and "ptal-init start" to launch hpoj, it will only serve the sane backend (as the printing backend is disabled by the patch). You can use /boot/loader.conf to load ulpt on startup: ulpt_load="YES" if you load ulpt on startup you can print (the PSC gets attached as /dev/ulpt, you do not need hpoj), if you do not load ulpt on startup (and you don't have it in the kernel!!) then you can scan (you need hpoj for this, the device gets attached as /dev/ugen0). In this configuration you can also setup hpoj with "ptal-init setup". Ok, the funny thing about is that you probably have to restart to change the configuration (I played around a little with kldload and kldunload but it seems that ugen0 doesn't appear after unlaoding ulpt). If at all possible I want the hpoj author to fix the problem with hpoj - I guess it's not neccessary to have the device open for scanning AND printing at the same time, probably after mlcd is set up the device could be closed to reopen it for printing(??) After starting hpoj the devices are not opened anyway (are they?). I haven't investigated closesly but I guess it requires more understanding of hpoj. So, I hope this is archived now on the net at last. Regards, Raphael -- G System, The Evolving Universe - http://www.g-system.at |