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

Add support for YT01 model #23

Closed
williamd1k0 opened this issue May 4, 2022 · 15 comments
Closed

Add support for YT01 model #23

williamd1k0 opened this issue May 4, 2022 · 15 comments

Comments

@williamd1k0
Copy link

I bought this model recently and ended up getting a little frustrated because the only way to use it was through a suspicious mobile app.
I will be very grateful if you can add support for this model. I can help you with any information, testing and maybe even coding.

Recommended app: (iBleem) https://play.google.com/store/apps/details?id=com.bleem.liugm

Thank you so much for working on this project.

@NaitLee
Copy link
Owner

NaitLee commented May 4, 2022

I see it's yet another brand.
I'm gonna try another app, because it's a) by same vendor, b) looks cleaner ok, still that dirty, c) seems made for world I think it's also machine translated... "also"...
I don't think it's a fast process, since it's really different.

@NaitLee
Copy link
Owner

NaitLee commented May 4, 2022

Hi, you may help me to find the Bluetooth "Characteristics" of YT01.
Use nRF Connect, open the printer, find it with "Scanner" and see what's inside.

(the original app has really bad UI logic)

@williamd1k0
Copy link
Author

(the original app has really bad UI logic)

Yeah 😅, I've tried this "Fun Print" now and it's actually the same as iBleem with slight differences in the UI.

Screenshot_20220504-021213

Some pics:
IMG_20220504_021652
IMG_20220504_021907

Use nRF Connect, open the printer, find it with "Scanner" and see what's inside.

Ok, I will try it out.

@williamd1k0
Copy link
Author

Screenshots

Screenshot_20220504-024457
Screenshot_20220504-024515
Screenshot_20220504-024532
Screenshot_20220504-024537
Screenshot_20220504-025029
Screenshot_20220504-025044
Screenshot_20220504-025055
Screenshot_20220504-025101
Screenshot_20220504-025118
Screenshot_20220504-025128

Log 2022-05-04 02_47_13.txt
nRF Connect, 2022-05-04
YT01 (33:9F:3E:E3:1F:63)
V	02:45:45.750	Connecting to 33:9F:3E:E3:1F:63...
D	02:45:45.750	gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE)
D	02:45:46.935	[Broadcast] Action received: android.bluetooth.device.action.ACL_CONNECTED
D	02:45:46.974	[Callback] Connection state changed with status: 0 and new state: CONNECTED (2)
I	02:45:46.975	Connected to 33:9F:3E:E3:1F:63
D	02:45:46.980	wait(1600ms)
V	02:45:48.582	Discovering services...
D	02:45:48.582	gatt.discoverServices()
D	02:45:48.617	[Callback] Services discovered with status: 0
I	02:45:48.617	Services discovered
V	02:45:48.669	Generic Access (0x1800)
- Device Name [R W] (0x2A00)
Unknown Service (0000ae30-0000-1000-8000-00805f9b34fb)
- Unknown Characteristic [WNR] (0000ae01-0000-1000-8000-00805f9b34fb)
- Unknown Characteristic [N] (0000ae02-0000-1000-8000-00805f9b34fb)
   Client Characteristic Configuration (0x2902)
- Unknown Characteristic [WNR] (0000ae03-0000-1000-8000-00805f9b34fb)
- Unknown Characteristic [N] (0000ae04-0000-1000-8000-00805f9b34fb)
   Client Characteristic Configuration (0x2902)
- Unknown Characteristic [I] (0000ae05-0000-1000-8000-00805f9b34fb)
   Client Characteristic Configuration (0x2902)
- Unknown Characteristic [R W] (0000ae10-0000-1000-8000-00805f9b34fb)
Unknown Service (0000ae3a-0000-1000-8000-00805f9b34fb)
- Unknown Characteristic [WNR] (0000ae3b-0000-1000-8000-00805f9b34fb)
- Unknown Characteristic [N] (0000ae3c-0000-1000-8000-00805f9b34fb)
   Client Characteristic Configuration (0x2902)
D	02:45:48.670	gatt.setCharacteristicNotification(0000ae02-0000-1000-8000-00805f9b34fb, true)
D	02:45:48.673	gatt.setCharacteristicNotification(0000ae04-0000-1000-8000-00805f9b34fb, true)
D	02:45:48.677	gatt.setCharacteristicNotification(0000ae05-0000-1000-8000-00805f9b34fb, true)
D	02:45:48.681	gatt.setCharacteristicNotification(0000ae3c-0000-1000-8000-00805f9b34fb, true)

@NaitLee
Copy link
Owner

NaitLee commented May 4, 2022

Oh thank you, it's very detailed 😄
Next step for me is to trick the app to send data, dump it & analyze.
The tool is also nRF Connect.
And I feel these steps are universal and worth to make a tutorial later 🙃

The printer is completely different, maybe including communication "magic data".
Let me gather more...

@NaitLee
Copy link
Owner

NaitLee commented May 4, 2022

Oh, wait, Services/Characteristics UUID needs to be full.
Long tap on each entry (and sub-entry) in connected YT01 "Client", on right-top there's copy button.
Put them in a text file, and be sure to label corresponding Properties (read, write, notify, etc)
It's a repeating process, but maybe worthwhile 😉

@NaitLee
Copy link
Owner

NaitLee commented May 4, 2022

Some side notes:

  • the original app is actually in JavaScript
  • it also support many other models, of their own
  • the real code is in assets (of apk). but obfuscated
  • rough stat: more than 50 js files, each is around 100kib in average. after prettify there will be 10,000 lines per file
  • that doesn't mean it's better than similar things: bad naming convention, pinyin variable names & english typos, poorly managed processing logic (aka Spaghetti Code, for example using if everywhere for different printer models)
  • above is got with minified code. just think about how's their codebase.
  • the communication "magic data" is buried in these obscure code. it will take some time to dig its logic out, but our traffic dumping technique may improve efficiency
  • inside, the only thing I feel good about is i18n

In order to really support all YTXX I think we need more people, for sharing & testing.
But I have no ability to do them all by myself 😢

I will continue slowly.

EDIT: just now I see the "magic data" is likely to be the same (or very similar) as GBXX models.

@williamd1k0
Copy link
Author

Oh, wait, Services/Characteristics UUID needs to be full. Long tap on each entry (and sub-entry) in connected YT01 "Client", on right-top there's copy button. Put them in a text file, and be sure to label corresponding Properties (read, write, notify, etc) It's a repeating process, but maybe worthwhile 😉

No problem, I'll do that as soon as possible! (I'm a bit busy right now)

@williamd1k0
Copy link
Author

It's a repeating process, but maybe worthwhile

Thanks to KDE Connect I was able to share the text directly to my PC instead of copying/pasting everything manually 😅

Let me know if anything is still missing.

Generic Access:
  UUID: 0x1800
  PRIMARY SERVICE:
    Device Name:
      UUID: 0x2A00
      Properties: READ, WRITE
      Parsed value: YT01
      Raw value: (0x) 59-54-30-31, "YT01"

Unknown Service:
  UUID: 0000ae30-0000-1000-8000-00805f9b34fb
  PRIMARY SERVICE:
    Unknown Service:
      UUID: 0000ae01-0000-1000-8000-00805f9b34fb
      Properties: WRITE NO RESPONSE
    Unknown Service:
      UUID: 0000ae02-0000-1000-8000-00805f9b34fb
      Properties: NOTIFY
    Unknown Service:
      UUID: 0000ae03-0000-1000-8000-00805f9b34fb
      Properties: WRITE NO RESPONSE
    Unknown Service:
      UUID: 0000ae04-0000-1000-8000-00805f9b34fb
      Properties: NOTIFY
    Unknown Service:
      UUID: 0000ae05-0000-1000-8000-00805f9b34fb
      Properties: INDICATE
    Unknown Service:
      UUID: 0000ae10-0000-1000-8000-00805f9b34fb
      Properties: READ, WRITE
      Parsed value: (0x) 00-00-00-00
      Raw value: (0x) 00-00-00-00

Unknown Service:
  UUID: 0000ae3a-0000-1000-8000-00805f9b34fb
  PRIMARY SERVICE:
    Unknown Service:
      UUID: 0000ae3b-0000-1000-8000-00805f9b34fb
      Properties: WRITE NO RESPONSE
    Unknown Service:
      UUID: 0000ae3c-0000-1000-8000-00805f9b34fb
      Properties: NOTIFY

@NaitLee
Copy link
Owner

NaitLee commented May 5, 2022

I see they are just very alike.
Please test if this brute way would work:

  • Pick a release, or clone repo & install deps
  • Open file printer_lib/models.py, inside add a model YT01 as the same as any other:
     Models = {
         'YT01': Model(384, False),
         'GB01': Model(384, False),
         # ...
     }
  • Try to print...

Edit: I've made this change in newest commit. You can simply try it by cloning repo.

@williamd1k0
Copy link
Author

It's working!!
IMG_20220505_130652

@NaitLee
Copy link
Owner

NaitLee commented May 5, 2022

Ah great 😄
So next times I should not overlook other models. They have big chance to be the same 😅
But who knows when I will meet a really different one...

Side note: this appearance (printer face) is the newest kind of my local Online store
Off-topic: our laptop is very similar

@williamd1k0
Copy link
Author

Off-topic: our laptop is very similar

Hehe, mine is a Lenovo Ideapad S145.

So, I will close the issue now. Thanks again for working on this project, it's really helpful.
I will definitely help improve the app (UI, features, i18n etc) in the future, one thing I was looking forward to before buying the printer was this specific project: https://github.com/receiptline/receiptline (I really like to automate things through the command-line 😅).

@braintapper
Copy link

FWIW, I was able to get my cat printer model (MX05) to work using the YT01 settings.

@NaitLee
Copy link
Owner

NaitLee commented May 31, 2022

So there are many "unknown but supported" models.
That may mean I should put a "Test other devices" feature, with existing settings :)

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