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

Large number in peek #1

Open
easyworld opened this issue Jun 6, 2020 · 2 comments
Open

Large number in peek #1

easyworld opened this issue Jun 6, 2020 · 2 comments

Comments

@easyworld
Copy link

easyworld commented Jun 6, 2020

I modified example_PokemonSwSh_SurpriseTrade.py and try this peek 0x4293D8B0 10320 to get all pokemon in boxes, but it failed, Python says index out of range.
I checked code from global_in.read(size, timeout=0), it doesn't have enough size of data. Is there any limitations of the size in peek operation? The original sys-botbase can support this peek 0x4293D8B0 10320 correctly.

@fishguy6564
Copy link
Owner

This issue is due to the maximum transfer size being 4080 bytes that is present when communicating via USB. This is an issue that I have ran into very recently, so I have not uploaded a solution publicly, although, one exists. It has not been uploaded publicly yet as I am still working on the next update for USB-Botbase. I will release the updated read method which should solve this issue for now at least.

@easyworld
Copy link
Author

easyworld commented Jun 6, 2020

The new python script doesn't work if the peek size parameter is larger than 478. After I change the 4080 to 478 in the new scirpt, it works when size is less or equal than 536. If peek size is greater than 536, python says:

Traceback (most recent call last):
  File "./example_PokemonSwSh_SurpriseTrade.py", line 120, in <module>
    main()
  File "./example_PokemonSwSh_SurpriseTrade.py", line 117, in main
    pokemonBytes = readData()
  File "./example_PokemonSwSh_SurpriseTrade.py", line 56, in readData
    x = global_in.read(chunkSize, timeout=0).tobytes()
  File "MyPython3Path\lib\site-packages\usb\core.py", line 402, in read
    return self.device.read(self, size_or_buffer, timeout)
  File "MyPython3Path\lib\site-packages\usb\core.py", line 983, in read
    ret = fn(
  File "MyPython3Path\lib\site-packages\usb\backend\libusb0.py", line 537, in bulk_read
    return self.__read(_lib.usb_bulk_read,
  File "MyPython3Path\lib\site-packages\usb\backend\libusb0.py", line 622, in __read
    ret = int(_check(fn(
  File "MyPython3Path\lib\site-packages\usb\backend\libusb0.py", line 431, in _check
    raise USBError(errmsg, ret)
usb.core.USBError: [Errno None] b'libusb0-dll:err [_usb_reap_async] reaping request failed, win error: \xc1\xac\xb5\xbd\xcf\xb5\xcd\xb3\xc9\xcf\xb5\xc4\xc9\xe8\xb1\xb8\xc3\xbb\xd3\xd0\xb7\xa2\xbb\xd3\xd7\xf7\xd3\xc3\xa1\xa3\r\n\n'

The last error string is Chinese which means "The device connected to the system is not functioning."

And my main function is like this:

def main():
	attemptConnection()
	sendCommand("click Y")
	time.sleep(2)
	sendCommand("click B")
	time.sleep(2)
	sendCommand("peek 0x4293D8B0 537")
	pokemonBytes = readData()
	print (pokemonBytes)

My switch system version is 10.0.3|AMS 0.12.0|E

Koi-3088 referenced this issue in Koi-3088/USB-Botbase-archived Nov 29, 2021
remove unnecessary library
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