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

Seria Transport freezes infinitly on windows 10 #18

Open
grodino opened this issue May 11, 2016 · 8 comments
Open

Seria Transport freezes infinitly on windows 10 #18

grodino opened this issue May 11, 2016 · 8 comments

Comments

@grodino
Copy link

grodino commented May 11, 2016

Hi pebblers,

I'm currently trying to get libpebble2 running on windows 10. I'm using the serial transport to communicate with my watch.
When I call pebble.run_async() the code doesn't do anything and never stop, without displaying anything.

I first thought that the problem was coming from python 3.5 but I tried it too on python 2.7 and it didn't work.

I am on windows 10 and here is my code :

import logging
import serial

from libpebble2.communication import PebbleConnection
from libpebble2.communication.transports.serial import SerialTransport

from libpebble2.protocol import *
from libpebble2.services.notifications import Notifications
from libpebble2.services.screenshot import Screenshot

logging.basicConfig(level=logging.DEBUG)

pebble = PebbleConnection(
    SerialTransport('COM3'),
    log_protocol_level=logging.DEBUG,
    log_packet_level=logging.DEBUG
    )

pebble.connect()
pebble.run_async()

Thank you for your help !

@iksaku
Copy link

iksaku commented Jun 9, 2016

It is not freezed, it is waiting for you to send instructions. Try sending a Ping message as described in the Docs

@grodino
Copy link
Author

grodino commented Jun 9, 2016

Thank you for your answer,
In deed I tried to do it several times and it did not do anything. The only result I get when I set debug level to DEBUG is this :

DEBUG:libpebble2.communication:-> WatchVersion(command=None, data=WatchVersionRequest())
DEBUG:libpebble2.communication:-> 0001001000

And here is the code :

import logging
import serial

from libpebble2.communication import PebbleConnection
from libpebble2.communication.transports.serial import SerialTransport

from libpebble2.protocol import *

logging.basicConfig(level=logging.DEBUG)

pebble = PebbleConnection(
    SerialTransport('COM10'),
    log_protocol_level=logging.DEBUG,
    log_packet_level=logging.DEBUG
    )
pebble.connect()
pebble.run_async()

print(pebble.watch_info.serial)

pebble.send_packet(PingPong(message=Ping(), cookie=53))
pebble.read_from_endpoint(PingPong)

print(pebble.watch_info.serial)

@iksaku
Copy link

iksaku commented Jun 9, 2016

Why don't you try print results from endpoint reading? You are just printing watch_info property

@grodino
Copy link
Author

grodino commented Jun 9, 2016

Yes, I tried it but it is breaking before this.

Actually, the freeze occurs when the SerialTransport calls serial.write() when trying to fetch Watchversion

I've heard about Windows 10 problems with bluetooth COM ports, it might be something like that.

@iksaku
Copy link

iksaku commented Jun 9, 2016

Could you provide some "breaking" code?

@grodino
Copy link
Author

grodino commented Jun 10, 2016

I'm sorry I don't understand what you mean by "breaking code" ?

@iksaku
Copy link

iksaku commented Jun 13, 2016

Can you post code that actually "doesn't work"

@grodino
Copy link
Author

grodino commented Jun 13, 2016

Oh ok thank you for the explenation,
The breaking code is the few lines I posted before :

import logging
import serial

from libpebble2.communication import PebbleConnection
from libpebble2.communication.transports.serial import SerialTransport

from libpebble2.protocol import *

logging.basicConfig(level=logging.DEBUG)

pebble = PebbleConnection(
    SerialTransport('COM10'),
    log_protocol_level=logging.DEBUG,
    log_packet_level=logging.DEBUG
    )
pebble.connect()
pebble.run_async() # The code freezes here

print(pebble.watch_info.serial)

pebble.send_packet(PingPong(message=Ping(), cookie=53))
pebble.read_from_endpoint(PingPong)

print(pebble.watch_info.serial)

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

2 participants