USB devices
Chris Johnson (125) 825 posts |
A couple of nights ago my Iyonix froze while SyncDiscs was doing one of its overnight jobs. The error message was ‘too many open files’ (paraphrasing). I managed to get some control back by aborting some filer processes and using !Closefiles found most of the 255 file handles involved usb devices. I rebooted the machine (needed a full power cycle). I checked this morning and once again found lots of usbdevices listed as open files. I rebooted and checked for open files. There are currently just two usb devices listed. The listings in !Closefiles are of the form devices#sleep;interupt;endpoint1;$.USB5 (R) There appear to be two endpoints (1 and 2) for each USB number. When I had the complete freeze, the USB devices went up to USB235. All were odd numbers, but not all odd numbers were present. The only usb device(s) attached to the Iyonix is a lead from a KM switch for mouse and keyboard. *usbdevices lists *usbdevices No. Bus Dev Class Description 1 1 1 9/ 0 EHCI root hub 2 2 1 9/ 0 NEC OHCI Root Hub 3 3 1 9/ 0 NEC OHCI Root Hub 4 3 2 9/ 0 Texas Instruments TUSB2046 hub 5 3 3 0/ 0 Logitech USB Receiver I have never noticed this huge number of open usbdevices before (the Iyo is generally on 24/7). The same KM switch is attached to a PandaRO, but that doesn’t show the same devices#sleep entry. Are there any USB experts out there who can shed any light on what has started happening here? The OS version was mid-Feb, but I have now installed the 17 March version (the latest on this site) and will keep an eye on things. Puzzled from Edinburgh. |
Raik (463) 2061 posts |
Not sure, I’m not a expert. Maybe you become more usable Infos with USBInfo or with Colins USBDescriptor from the USBAudio package. |
Colin (478) 2433 posts |
Does the !Closefiles line appear after the Iyonix boots? Seems odd that the logitech receiver has an entry – the keyboard and mouse don’t use devicefs. Does it appear after using your KM switch? Are you using !HID or something like that? |
Grahame Parish (436) 481 posts |
I have a feeling that every time you switch away from and back to the RISC OS device it creates a new USB connection. I’ve seen errors at shutdown when I’ve used my USB KVM during a session along the lines of ‘device not found’ (I can’t remember it exactly) which I’ve taken to mean that the USB device it is trying to close is no longer valid against the USB handle it was previously assigned – but I could well be wrong. I never noticed this before when I ran the Iyonix and never on the BB xM which doesn’t go via a KVM, but is does happen on the ARMX6, which is KVM-connected. I often have to disconnect/reconnect the mouse or keyboard from the KVM after returning the machine as the muse or keyboard has stopped responding. A quick connect cycle gets it working again. I have HID running as I’m currently only using a two button mouse and need the menu key on the keyboard active so I have the ‘third button’. |
Chris Johnson (125) 825 posts |
Thanks for the comments Colin. It is definitely a function of switching the KVM. Each time I switch back to the Iyo from the Panda, two new file handles appear, corresponding to endpoints 1 and 2. I am using HID on the Iyonix but not on the Panda. Is this why I don’t get the same behaviour on the Panda. HID caused instability on the Panda when I tried it out a while back. The question is – what has changed? The KVM switch has been in use since I got the Panda – well over a year, and since both machines run 24/7 it should have surfaced before now. Now a thought – I upgraded HID a month or so ago. Maybe that was the change. I’ll have to root around and see if I still have a copy of the old version. |
Colin (478) 2433 posts |
Yes it’s the same as unplugging the device and plugging it back in again. I use a USB switch and have not encountered any problems. |
Chris Johnson (125) 825 posts |
Just to add – the Logitech receiver is the wireless gizmo, plugged into the KVM for the wireless mouse/keyboard. |
Grahame Parish (436) 481 posts |
Likewise here – Logitech Unifying receiver for the keyboard and an equivalent Kensington one for the cordless trackball. |
Colin (478) 2433 posts |
My switch is connected to my monitors usb hub which has a wired keyboard and logitech receiver for my mouse plugged into it so I don’t think switching just the receiver should be a problem. If instead of switching the logitech receiver away from the iyonix you unplug the receiver from the switch does the entry remain in !Closefiles? If so does the same thing happen if you plug it directly to the iyonix and unplug it – it may have nothing to do with the switch. |
Dave Higton (1515) 3526 posts |
I have in the past had trouble with USB device handles. In some cases, if a device was unplugged, the handle was still there, and was indestructible. I’ve got a USB switch at home that allows me to swap a keyboard and mouse between a BBxM and a Raspberry Pi. It never occurred to me to look at whether the handles remain open when I switch away. I’ll have a look tonight. |
Chris Johnson (125) 825 posts |
OK. I have now made some more tests. I managed to manually go back to an old version of HID. However, that made no difference. The file handles associated with device#sleep still appeared after a boot, and increased after each switch of the KVM. I have now manually removed HID and its associated modules from the boot process and after a reboot, the device#sleep does not appear at all, either after the boot or after switching the KVM. Thus it is HID which is creating these device files. What I do not understand is why this has only recently caused the Iyonix to crash – i.e. exhaust the 255 file handles. I have always used HID on the Iyonix. My usage has not changed recently, Panda and Iyo run 24/7 – Iyo is used for mail and news among other things, and the Panda is used mainly for software development, so I am continually switching between them. Has anything changed in usb in the OS recently? I usually update the OS once a month or so, maybe more often. The Iyonix was running a mid-Feb version of 5.21, although it is now at the latest. |
John Williams (567) 768 posts |
I was wondering that myself! My Nokia C3 ’phone used to appear – or rather its memory card did – as a mass storage device via USB, but it now seems to have ceased to do so at all, complaining “No reply from host”. I don’t use the connection very often, but it may have coincided with moving from R12 to R14. Unfortunately, once R14 was working OK I discarded all my R12 versions. Going away imminently, so don’t want to spend the time trying a reversion to test this ATM. |
Jeffrey Lee (213) 6048 posts |
I don’t think there have been any USB/DeviceFS related changes for at least a couple of months, and nothing I can think of which might cause file handles to start leaking. (edit: the move from RC12 to RC14 is a special case since there are many months of changes in the update, including significant USB changes) I’m assuming you don’t end up with lots of phantom devices appearing in *USBDevices? And I’m assuming you end up with an ascending sequence of USB device numbers in the list of open files? |
Colin (478) 2433 posts |
Is this softloaded? Do you have an earlier RISC OS version in rom to try. |
Rick Murray (539) 13840 posts |
Coming over this side of La Manche?
Does the C3 support MTP? Check you are using MSC/mass storage mode and not MTP mode if so. Are the USB contacts clean? I have found that the USB socket is quite a magnet for random fluff. Try hard-resetting the phone. Sometimes that fixes things. Usually holding the power button for 5-10 seconds will do it, unless you have a type that you can switch off and remove the battery for a few seconds… |
John Williams (567) 768 posts |
Sorry – haven’t mastered nested quotes:
Rick: Me: Rick: Are the USB contacts clean? I have found that the USB socket is quite a magnet for random fluff. Try hard-resetting the phone. Sometimes that fixes things. Me: Yup! That’s sorted it! Arriving Tue for 3 weeks. How’s Mom (by e-mail, stp) |
Chris Johnson (125) 825 posts |
OK. I was a bit hasty assuming something had changed recently. Reverting to 5.18 and reinstalling HID still shows the problem.
There are no extra devices appearing – the same devices are listed. However, the device numbers for a TI hub and the usb receiver increase each time I switch back to the Iyo in line with the new file handles. *usbdevices No. Bus Dev Class Description 1 1 1 9/ 0 EHCI root hub 2 2 1 9/ 0 NEC OHCI Root Hub 3 3 1 9/ 0 NEC OHCI Root Hub 4 3 2 9/ 0 Texas Instruments TUSB2046 hub 5 3 3 0/ 0 Logitech USB Receiver *usbdevices No. Bus Dev Class Description 1 1 1 9/ 0 EHCI root hub 2 2 1 9/ 0 NEC OHCI Root Hub 3 3 1 9/ 0 NEC OHCI Root Hub 12 3 2 9/ 0 Texas Instruments TUSB2046 hub 13 3 3 0/ 0 Logitech USB Receiver I can see now why the usbdevice (odd) number goes up by two each time.
As above. I tried randomly closing some of the older file handles in the middle of the list. Some closed without apparent effect, and then the machine was stiffed when I closed another. I guess I need to keep an eye on the file handle situation and reboot the machine when available handles get a bit low. |
Steve Pampling (1551) 8170 posts |
Rather than use the bq dot abbreviation, use the blockquote in < > version. HTML style for the open and close and nesting. |
Chris Johnson (125) 825 posts |
The devices#sleep entries in the list of file handles is coming from the USBHID module (from looking at it in Zap. Thinking about what in HID I actually make use of the most, I guess it is the wimp scroll module (I quite miss being able to scroll any window with the mouse on the Panda). Maybe I will modify HID predesk stuff just to load that. |