Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confirmed to work with b3s #20

Open
AndyADD opened this issue Apr 8, 2024 · 8 comments
Open

Confirmed to work with b3s #20

AndyADD opened this issue Apr 8, 2024 · 8 comments

Comments

@AndyADD
Copy link

AndyADD commented Apr 8, 2024

I apologize if I could have gone a different way about confirming this. I was able to successfully print with bluetooth. believe it or not, I cannot find an actual micro usb cable that has data cables inside, I am kind of annnoyed by that honestly. The command was standard except I didn't rotate the image. Full command "sudo poetry run python niimprint -c bluetooth -a mac address -r 0 -i examples/B21_30x15mm_240x120px.png"

I used the default model (b21) This could vary on which distro you use, I am on Manjaro 23.1.4 kde, whenever I want to send a label to print I have to confirm code in the bottom right. Every print it makes the same noise on a successful connection, and then makes the noise again after it prints, idk if this is something in your code, I dabble in python so I may see. If I find an actual data transfer micro usb I'll test it and change this later.

@AndBondStyle
Copy link
Owner

@AndyADD what bluetooth address are you using? Usually there's two different ones for one printer. And did you trust/pair/connect to the printer first using bluetoothctl?

@AndyADD
Copy link
Author

AndyADD commented Apr 8, 2024

@AndBondStyle Bluetooth address I used starts with an "E1" and the other mac address is the same except of "E1", its "C1" if you want the whole mac address let me know I'll provide it, just was sure if it was necessary. I paired with both mac addresses, and I'll be honest I was making things more complicated than they needed to be I believe.

I use bluetoothctl, however, the bluetooth UI I was able to pair/connect as well and still send labels to print which IDK what stock program manjaro supplies, but it seems to work with bluetoothctl when I installed it.

If you need more info im happy to provide it, I don't use github much, and I kept making guesses on what order I neeed to do to make it work, like I mentioned im probably over complicating it.

Oh, I didn't use the trust command but I was stopped given those pin challenges on each print, idk what I did to make that stop.

@AndBondStyle
Copy link
Owner

AndBondStyle commented Apr 8, 2024

@AndyADD there's a note in the readme (recently added):

It seems like B21 and B1 (and maybe other models?) have two bluetooth adresses. They have the same last 3 bytes, but the first 3 are rotated (for example AA:BB:CC:DD:EE:FF and CC:AA:BB:DD:EE:FF). Connection works only if you disconnect from one and connect to the other. After connecting via bluetoothctl you may get org.bluez.Error.NotAvailable br-connection-profile-unavailable error, but printing works fine regardless.

To identify which address is the correct one, run bluetoothctl info on the address you want to check. The incorrect one might list UUID: Generic Access Profile and UUID: Generic Attribute Profile, while the correct one will list UUID: Serial Port.

Could you write both full addresses, and also bluetoothctl info output? My current theories are:

  1. You should disconnect from one of the addresses, and use only the right one (serial)
  2. Maybe printer disconnects / goes to sleep because currently we don't send keepalive messages (and we can't, because the script runs in a one-shot style, not in a daemon mode like I suggested in Daemon mode and keepalive #9)
  3. Maybe B3S printer is special in some way I don't know (I only have B21)

@AndyADD
Copy link
Author

AndyADD commented Apr 8, 2024

@AndBondStyle Here is the output of the two, and it appears I only need to connect to the serial port mac address, I am paired to both mac addresses but it seems I dont need to do the connect/disconnect thing, I can connect to the serial port mac address and have it still print.

Device E1:E3:31:09:08:60 (public)
Name: B3S-E331090860
Alias: B3S-E331090860
Class: 0x00040680 (263808)
Icon: printer
Paired: yes
Bonded: yes
Trusted: yes
Blocked: no
Connected: no
LegacyPairing: no
UUID: Service Discovery Serve.. (00001000-0000-1000-8000-00805f9b34fb)
UUID: Serial Port (00001101-0000-1000-8000-00805f9b34fb)
UUID: PnP Information (00001200-0000-1000-8000-00805f9b34fb)
Modalias: bluetooth:v005Dp223Bd0100

Device C1:E3:31:09:08:60 (random)
Name: B3S-E331090860
Alias: B3S-E331090860
Paired: yes
Bonded: yes
Trusted: no
Blocked: no
Connected: no
LegacyPairing: no
UUID: Generic Access Profile (00001800-0000-1000-8000-00805f9b34fb)
UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
UUID: Device Information (0000180a-0000-1000-8000-00805f9b34fb)
UUID: Vendor specific (0000e0ff-3c17-d293-8e48-14fe2e4da212)
Modalias: bluetooth:v005Dp0000d0100

@AndBondStyle
Copy link
Owner

@AndyADD thanks for the info! To be clear, the only problem you're having right now is that your printer makes noise every time it starts/ends the print?

@AndyADD
Copy link
Author

AndyADD commented Apr 8, 2024

@AndyADD thanks for the info! To be clear, the only problem you're having right now is that your printer makes noise every time it starts/ends the print?

Well from what I am seeing with the bluetooth icon in the bottom right, it appears to connect -> print -> disconnect. Which is not a big deal might be a quirk with this model.

@JoshGud777
Copy link

I have a D11 and it does the same thing AndyADD states. connect -> print -> disconnect
Other than that it worked great! Used the vendor app to calibrate for gaps and offsets tho.
I'm currently working on reversing the NIIMBOT app. Maybe I will find something useful.

@AndBondStyle
Copy link
Owner

@JoshGud777 the official app is, well, an app, meaning that it's a long-running process. And it probably sends keepalive messages in the background to prevent the printer from going to sleep. On the other hand, our script just starts, does the printing and exits, meaning we don't have any way to "keep the connection alive". Except to implement something like described in #9 (daemon/background mode)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants