javl / InstaxBLE

MIT License
54 stars 6 forks source link

Doesn't work with Windows #17

Open rsliu-hri opened 5 months ago

rsliu-hri commented 5 months ago

Hi,

I am trying to run the script on Window 11 Pro and Instax Wide.

It structed at send_packet(). The log in terminal as follows:

Searching for instax printer...
Connecting to INSTAX-20089434(IOS) [fa:ab:bc:57:8c:53]
Connected
Getting function info...
sending eventtype: EventType.SUPPORT_FUNCTION_INFO
> number of parts to send: 1
sleep
sleep
sleep
sleep
sleep
sleep
sleep
sleep
sleep
sleep
sleep
sleep
javl commented 3 months ago

Not sure what is happening here; where does the 'sleep' message come from? Please post the actual script you're running, thanks.

yilverdeja commented 2 weeks ago

Also having an issue running on Windows 11. I couldn't install the dependencies of simplepyble for the suggested version 0.6.2.dev2 so I updated it to 0.7.3. Now when I run InstaxBLE.py, it runs into a segmentation fault after it sends the first packet to the mini link.

I imported faulthandler and enabled it before the instax.connect() on the main function. I've also modified send_packet to print some information:

def send_packet(self, packet):
    """ Send a packet to the printer """
    # ...
    print("send_packet", packet, "waiting for response", self.waitingForResponse)
    while self.waitingForResponse and not self.dummyPrinter and not self.cancelled:
        self.log("sleep")
        sleep(0.05)
    # ...

This is the result:

[INFO] SimpleBLE: D:\a\SimpleBLE\SimpleBLE\simpleble\src\backends\windows\Utils.cpp:33 in initialize_winrt: CoGetApartmentType: cotype=-1, qualifier=0, result=800401F0
[INFO] SimpleBLE: D:\a\SimpleBLE\SimpleBLE\simpleble\src\backends\windows\Utils.cpp:41 in initialize_winrt: RoInitialize: result=0
Searching for instax printer...
Connecting to INSTAX-15455839(IOS) [fa:ab:bc:5a:1e:54]
Connected
send_packet b'Ab\x00\x08\x00\x02\x00R' waiting for response False
send_packet b'Ab\x00\x08\x00\x02\x01Q' waiting for response True
sleep
sleep
sleep
Windows fatal exception: access violation

Thread 0x00006da8 (most recent call first):
  File "C:\Users\PC\Documents\Github\javl\InstaxBLE\InstaxBLE.py", line 337 in send_packet
  File "C:\Users\PC\Documents\Github\javl\InstaxBLE\InstaxBLE.py", line 452 in get_printer_info
  File "C:\Users\PC\Documents\Github\javl\InstaxBLE\InstaxBLE.py", line 221 in connect
  File "C:\Users\PC\Documents\Github\javl\InstaxBLE\InstaxBLE.py", line 514 in main
  File "C:\Users\PC\Documents\Github\javl\InstaxBLE\InstaxBLE.py", line 552 in <module>
Segmentation fault

Let me know if you need any more information. Would love to find a way to make this work!