Re: Bluetooth printer connection error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2020-12-09 at 12:14 +0100, Laurent Vivier wrote:
> Le 09/12/2020 à 12:00, Bastien Nocera a écrit :
> > On Tue, 2020-12-08 at 22:25 +0100, Laurent Vivier wrote:
> > > Hi,
> > > 
> > > TL;DR:
> > > 
> > > I can pair my bluetooth printer but it fails to connect:
> > > 
> > >   $ bluetoothctl connect DC:0D:30:90:23:C7
> > > 
> > >   Attempting to connect to DC:0D:30:90:23:C7
> > >   [CHG] Device DC:0D:30:90:23:C7 Connected: yes
> > >   [CHG] Device DC:0D:30:90:23:C7 ServicesResolved: yes
> > >   Failed to connect: org.bluez.Error.NotAvailable
> > > 
> > > What do I need to add to my system to have this working?
> > 
> > As I mentioned in the original bug:
> > https://bugzilla.redhat.com/show_bug.cgi?id=1904686
> > 
> > I don't expect the "connect" command to do anything. There's
> > nothing to
> > "connect" to, as bluez doesn't create rfcomm device nodes
> > automatically
> > when "connecting" to devices with serial profiles (otherwise one
> > couldn't connect to them with other applications without going
> > through
> > the device node...).
> 
> Yes, I didn't understand what you meant...
> 
> My question is: what piece of code I need to write or modify to have
> the
> "connect" operation working?

Again, it's bluez' prerogative that serial profiles don't automatically
get a serial device node attached.

Either you need to create the rfcomm device node manually, or you need
to jump through the same hoops many apps do, using SDP to find the
RFCOMM port on the remote device, and connecting to that port using an
AF_BLUETOOTH socket.

The cups backend in the bluez sources does both of those things.

> 
> > If the printer has uses the SPP or HCRP printing profiles, you
> > should
> > see it when using:
> > /usr/lib/cups/backend/bluetooth
> > without any arguments.
> 
> As I don't see it once it is paired, I guess it is not using one of
> these profiles.

I don't remember how this used to work, but you'll probably only see
something if the printer is visible.

You might be able to get the printer to work by adding:
bluetooth://DC0D309023C7
as a printer in the printer settings of your favourite desktop
environment, if it actually uses SPP.

running the cups backend with:
/usr/lib/cups/backend/bluetooth --get-deviceid bluetooth://DC0D309023C7

should show you whether it can get autoconfigured for CUPS use.

> 
> > Otherwise any apps or driver that supports the printer should be
> > able
> > to create a serial link directly to the device without creating a
> > device node in /dev.
> > 
> > FWIW, looks like the printer uses a proprietary protocol between
> > their
> > own app and the printer, and that they don't provide Linux support.
> > Short of reverse engineering that protocol, the printer is unlikely
> > to
> > work with Linux.
> 
> I've written the CUPS driver that works fine with the rfcomm device.
> In fact, it's not proprietary, it's ESC/POS protocol.
> 
> https://github.com/vivier/phomemo-tools
> 
> I'm working on my code to use python-escpos rather than my hack and
> I'd
> like to integrate smoothly the printer in the bluetooth stack.
> 
> It works also with USB, but it's a shame not to use bluetooth with a
> printer that has an internal battery.





[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux