2 k40s one pc using k40 whisperer

At least with the [0] it worked with 1 machine the [1] broke it for everything. :slight_smile:

I have a different solution.

2 Likes

The [1] wouldn’t break things if there are 2 devices hooked to the system it won’t hit the index error and crash. It’s pretty shorthand. Really it should just check the first device if that connects then good. If it doesn’t connect them try a second device if one of those exists. And so on. The end result is you’d be able to run the same code in all versions and it would just connect to the second device if it exists and the first device threw an error because it was already in use.

1 Like

And it’s likely the best most simple solution. The only thing the chips have to distinguish themselves from each other is that the CH341 has a version. So you can get the IC version and then if you knew which was which you could connect to just that device. Otherwise it’s just the device that moved is the device this version of that program is connected to. But, I always thought that if both disconnected then reconnected they might switch places or something (they really shouldn’t). But there is categorically nothing saved on the device itself and literally no way to tell one device from another device. There’s no eeprom anywhere on the board. I also bandied about things like resetting the CH341 chip and not putting in back into EPP 1.9 mode, but none of that worked. The only way to tell one machine from the other is if they happen to differ in CH341 version which a lot of them will.

    try:
        buffer = device.ctrl_transfer(bmRequestType=0xC0,
                                      bRequest=0x5F,
                                      wValue=0,
                                      wIndex=0,
                                      data_or_wLength=2,
                                      timeout=200)
    except usb.core.USBError:
        return -1
    if len(buffer) < 0:
        return -1
    else:
        return (buffer[1] << 8) | buffer[0]

0xC0 is mCH341_VENDOR_READ,
0x5F is mCH341A_GET_VER

1 Like

Oh, also, even without 2 K40s you can buy a couple super-cheap eeprom readers and they’ll have the CH341 chip and be indistinguishable from a K40 to the computer except that the status replies won’t be the same.

Moshiboards also use the same chip, also in EPP 1.9 mode, but they have different status reports and work entirely differently. In fact, the Moshi Idle is 205 so if you ever see that you could tell the user that you are not compatible with Moshiboards. 207 means busy running a program. And it just writes all the programs to memory and runs. While running it’ll return 207s and when finished it’ll spit out 205s again.

1 Like

@Lothian_Woodworks
I uploaded a new version of K40 Whisperer (V0.50) that can handle controlling multiple K40 lasers on the same computer when opening more than one session of K40 Whiperer on the same machine.

https://www.scorchworks.com/K40whisperer/k40whisperer.html#download

K40 Whisperer will iterate through the laser devices connected to the computer until it finds the next available laser (K40 Whisperer determines if a laser is in use by trying to call set_configuration(). Lasers that are connected to another session of K40 Whisperer will not allow K40 Whisperer to successfully set_configuration(). )

3 Likes