Skip to main content
Topic: Device not responding (Read 2054 times) previous topic - next topic

Device not responding

Hi all,

I received my IRToy V2 a few days ago and try experimenting (Linux only).
I installed firmware V22 successfully and had success playing around in IrScrutinizer 1.4.2. I exported one signal to IrToy-bin format (only one signal which mutes my receiver).

Next I wanted to check if the irtoy command can replay this signal, so I compiled irtoy from the latest git sources (https://github.com/myshen/IRToyRecPlay).

I used the following command line:
Code: [Select]
./irtoy -d /dev/ttyACM0 -p -f mute.bin

This works, my receiver is muted!
This is the output:
Code: [Select]
./irtoy -d /dev/ttyACM0 -p -f mute.bin 
+-----------------------------------------+
|IR Toy Recorder/Player utility v21 (CC-0)|
|http://dangerousprototypes.com          |
+-----------------------------------------+
Opening IR Toy on /dev/ttyACM0 at 115200bps...
opening serial port /dev/ttyACM0
Setting up serial port...
Initializing IR Toy...
Asking for firmware version...(0/2)...wrote v...
Firmware version: V222
Entering IRs sample mode...(0/2)...wrote S...
IRs sampler version: S01
Current sample timer resolution: 21.3333us
binary mode
Enabling handshaking.
Asking for transmit count reporting.
Asking for completion reporting.
Playing back files...
Playing single file mute.bin
Playing mute.bin...
tx 760 bytes
fetching next packet size...handshake mode ON. requested 62 bytes.
Checking # bytes sent....62 bytes...ok.
fetching next packet size...handshake mode ON. requested 62 bytes.
Checking # bytes sent....62 bytes...ok.
fetching next packet size...handshake mode ON. requested 62 bytes.
Checking # bytes sent....62 bytes...ok.
fetching next packet size...handshake mode ON. requested 62 bytes.
Checking # bytes sent....62 bytes...ok.
fetching next packet size...handshake mode ON. requested 62 bytes.
Checking # bytes sent....62 bytes...ok.
fetching next packet size...handshake mode ON. requested 62 bytes.
Checking # bytes sent....62 bytes...ok.
fetching next packet size...handshake mode ON. requested 62 bytes.
Checking # bytes sent....62 bytes...ok.
fetching next packet size...handshake mode ON. requested 62 bytes.
Checking # bytes sent....62 bytes...ok.
fetching next packet size...handshake mode ON. requested 62 bytes.
Checking # bytes sent....62 bytes...ok.
fetching next packet size...handshake mode ON. requested 62 bytes.
Checking # bytes sent....62 bytes...ok.
fetching next packet size...handshake mode ON. requested 62 bytes.
Checking # bytes sent....62 bytes...ok.
fetching next packet size...handshake mode ON. requested 62 bytes.
Checking # bytes sent....62 bytes...ok.
fetching next packet size...handshake mode ON. requested 62 bytes.
bytes_to_tx (62) is greater than number of bytes left (16). Setting to 16.
Checking # bytes sent....16 bytes...ok.
fetching next packet size...handshake mode ON. requested 62 bytes.
Bad sent count:  3E  74  02
Bad completion status: 00
shutting down...wait for serial port to clear...done.

But after this, I cannot invoke the command a second time because the device /dev/ttyACM0 is not accessible any more.
This is the output, after irtoy was invoked second time:

Code: [Select]
./irtoy -d /dev/ttyACM0 -p -f mute.bin 
+-----------------------------------------+
|IR Toy Recorder/Player utility v21 (CC-0)|
|http://dangerousprototypes.com          |
+-----------------------------------------+
Opening IR Toy on /dev/ttyACM0 at 115200bps...
opening serial port /dev/ttyACM0
Could not open serial port: errno: 5

The file /dev/ttyACM0 is not available after invoked the second time:
Code: [Select]
ls -a /dev/tty*
/dev/tty    /dev/tty13  /dev/tty19  /dev/tty24  /dev/tty3  /dev/tty35  /dev/tty40  /dev/tty46  /dev/tty51  /dev/tty57  /dev/tty62  /dev/ttyS1
/dev/tty0  /dev/tty14  /dev/tty2  /dev/tty25  /dev/tty30  /dev/tty36  /dev/tty41  /dev/tty47  /dev/tty52  /dev/tty58  /dev/tty63  /dev/ttyS2
/dev/tty1  /dev/tty15  /dev/tty20  /dev/tty26  /dev/tty31  /dev/tty37  /dev/tty42  /dev/tty48  /dev/tty53  /dev/tty59  /dev/tty7  /dev/ttyS3
/dev/tty10  /dev/tty16  /dev/tty21  /dev/tty27  /dev/tty32  /dev/tty38  /dev/tty43  /dev/tty49  /dev/tty54  /dev/tty6  /dev/tty8
/dev/tty11  /dev/tty17  /dev/tty22  /dev/tty28  /dev/tty33  /dev/tty39  /dev/tty44  /dev/tty5  /dev/tty55  /dev/tty60  /dev/tty9
/dev/tty12  /dev/tty18  /dev/tty23  /dev/tty29  /dev/tty34  /dev/tty4  /dev/tty45  /dev/tty50  /dev/tty56  /dev/tty61  /dev/ttyS0

This is how it looks like in /var/log/messages :
Code: [Select]
Now the IR Toy is plugged in:
Oct  7 14:06:49 1FC39F40 kernel: [ 9396.952203] usb 1-1.3: new full-speed USB device number 67 using ehci-pci
Oct  7 14:06:49 1FC39F40 kernel: [ 9397.063616] usb 1-1.3: New USB device found, idVendor=04d8, idProduct=fd08
Oct  7 14:06:49 1FC39F40 kernel: [ 9397.063627] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Oct  7 14:06:49 1FC39F40 kernel: [ 9397.063632] usb 1-1.3: Product: CDC Test
Oct  7 14:06:49 1FC39F40 kernel: [ 9397.063637] usb 1-1.3: Manufacturer: Dangerous Prototypes
Oct  7 14:06:49 1FC39F40 kernel: [ 9397.063641] usb 1-1.3: SerialNumber: 00000001
Oct  7 14:06:49 1FC39F40 kernel: [ 9397.064314] cdc_acm 1-1.3:1.0: ttyACM0: USB ACM device
Oct  7 14:06:49 1FC39F40 mtp-probe: checking bus 1, device 67: "/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-1/1-1.3"
Oct  7 14:06:49 1FC39F40 mtp-probe: bus: 1, device: 67 was not an MTP device

Now the above irtoy command is being invoked. You see no log entry after this is done

This is, when the above command is invoked second time:
Oct  7 14:07:10 1FC39F40 kernel: [ 9418.292288] usb 1-1.3: reset full-speed USB device number 67 using ehci-pci
Oct  7 14:07:21 1FC39F40 kernel: [ 9428.972287] usb 1-1.3: reset full-speed USB device number 67 using ehci-pci
Oct  7 14:07:32 1FC39F40 kernel: [ 9439.724297] usb 1-1.3: reset full-speed USB device number 67 using ehci-pci
Oct  7 14:07:37 1FC39F40 kernel: [ 9445.324291] usb 1-1.3: reset full-speed USB device number 67 using ehci-pci


Something odd is here; I did not use lirc, so it cannot be blamed. Is this because of the error when first invoked?:
Bad sent count:  3E  74  02
Bad completion status: 00
I attached the file mute.bin as bzip2 archive.

Thanks in advance,
 Erwein

Re: Device not responding

Reply #1
Sounds like you have "found" the bootloader mode. Just reflash the firmware.

There are several threads about this.

If this does not help, let us know.

Re: Device not responding

Reply #2
Hello,

the firmware has been flashed several times. I can always reproduce the issue. Once "./irtoy -d /dev/ttyACM0 -p -f mute.bin"  was used, you have to replug the IrToy device.
Regards,
 Erwein

Re: Device not responding

Reply #3
Btw Barf, if using your wonderful app IrScurinizer the device /dev/ttyACM0 is always available.

Re: Device not responding

Reply #4
Just another observation: if using this device with another computer, it works always.

Anyway: how can it be that IrScurinizer always works with my laptop, but the app irtoy not?

It looks like the app irtoy is very picky about timings sent to the usb port.

Re: Device not responding

Reply #5
If I understand correctly, whenever you issue the irtoy command, the IrToy first sends the expected signal, then goes into a coma. This coma is not bootloader mode (orange LED does not go on). The toy is un-coma-d by replugging. And it is working fine with IrScrutinizer (thanks for those nice words :-))? 
Right?

Does the output of lsusb (the linux command) differ between when the toy is sane and when it is in coma? What exactly is your operating system and hardware?

Another simple thing to try is with sudo and a negative nice-value, i.e.. 

sudo nice -n -20 ./irtoy ...

Re: Device not responding

Reply #6
Yes, exactly. The device just disappears and seems to be on coma. No orange LED on, the device seems gone:

Before executing irtoy :

Code: [Select]
root@1FC39F40:~/IRToyRecPlay# lsusb
Bus 001 Device 005: ID 0930:0225 Toshiba Corp.
Bus 001 Device 004: ID 10f1:1a5b Importek
Bus 001 Device 003: ID 0557:2221 ATEN International Co., Ltd Winbond Hermon
Bus 001 Device 002: ID 8087:8000 Intel Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 002 Device 007: ID 04d8:fd08 Microchip Technology, Inc. <-------- this must be IRToy
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

After executing irtoy :
Code: [Select]
root@1FC39F40:~/IRToyRecPlay# lsusb
Bus 001 Device 005: ID 0930:0225 Toshiba Corp.
Bus 001 Device 004: ID 10f1:1a5b Importek
Bus 001 Device 003: ID 0557:2221 ATEN International Co., Ltd Winbond Hermon
Bus 001 Device 002: ID 8087:8000 Intel Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

I even tried with the nice command, but there is no change in behavior.

I tried alternative firmware, no change:
viewtopic.php?f=29&t=7457

USBreset command does not work here, You must replug the device.

I read a lot of problems concerning Irtoy Hardware and Arduino/Raspi. Could it be there is an unresolved problem with this hardware with a certain kind of USB ports?
Reagrds

Re: Device not responding

Reply #7
I get the impression that the irtoy program is to blame (since everything works with IrScrutinizer (which uses the RXTX library for serial communications)),

What do you want to achieve? Sending an IR signal using the IrToy hardware from the command line?

Re: Device not responding

Reply #8
Exactly, I want to send ir commands via commandline.

Re: Device not responding

Reply #9
Haha, that is funny. I accidentally ran the irtoy command with a non existing bin file:

Code: [Select]
root@1FC39F40:~/IRToyRecPlay# nice -n -20 /root/IRToyRecPlay/IRToy -d /dev/ttyACM0 -p -f dfgdgf
+-----------------------------------------+
|IR Toy Recorder/Player utility v21 (CC-0)|
|http://dangerousprototypes.com          |
+-----------------------------------------+
Opening IR Toy on /dev/ttyACM0 at 115200bps...
opening serial port /dev/ttyACM0
Setting up serial port...
Initializing IR Toy...
Asking for firmware version...(0/2)...wrote v...
Firmware version: V222
Entering IRs sample mode...(0/2)...wrote S...
IRs sampler version: S01
Current sample timer resolution: 21.3333us
binary mode
Enabling handshaking.
Asking for transmit count reporting.
Asking for completion reporting.
Playing back files...
Bin file does not exist.
shutting down...wait for serial port to clear...done.
root@1FC39F40:~/IRToyRecPlay# nice -n -20 /root/IRToyRecPlay/IRToy -d /dev/ttyACM0 -p -f dfgdgf
+-----------------------------------------+
|IR Toy Recorder/Player utility v21 (CC-0)|
|http://dangerousprototypes.com          |
+-----------------------------------------+
Opening IR Toy on /dev/ttyACM0 at 115200bps...
opening serial port /dev/ttyACM0
Setting up serial port...
Initializing IR Toy...
Asking for firmware version...(0/2)...wrote v...(1/2)...wrote v...(2/2)...wrote v...no response. Abort.

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Found Garbage data when reading the firmware version.
Please re-start this utility again.
You may need to replug the IR toy.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

As you can see the device does not respond as well even without sending data when invoked the second time. To my mind it seems that the irtoy command does not close the device properly after using it.

Anyway I cannot explain why it works on another machine. So weired.