I'm developing a ttyACM device with ST microcontroller, and with the same code, my host could sometimes enumerate it successfully (below) but sometimes it just dump the below message. What does error -32 mean?
[FAIL TO ENUMERATE]
usb 1-2.1: new full speed USB device number 62 using ehci_hcd
usb 1-2.1: device descriptor read/64, error -32
usb 1-2.1: device descriptor read/64, error -32
usb 1-2.1: new full speed USB device number 63 using ehci_hcd
usb 1-2.1: device descriptor read/64, error -32
usb 1-2.1: device descriptor read/64, error -32
usb 1-2.1: new full speed USB device number 64 using ehci_hcd
usb 1-2.1: device not accepting address 64, error -32
usb 1-2.1: new full speed USB device number 65 using ehci_hcd
usb 1-2.1: device not accepting address 65, error -32
hub 1-2:1.0: unable to enumerate USB device on port 1
[SUCCESSFUL RESULT]
usb 1-3.1: new full speed USB device number 45 using ehci_hcd
usb 1-3.1: New USB device found, idVendor=0483, idProduct=5740
usb 1-3.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 1-3.1: Product: ChibiOS/RT Virtual COM Port
usb 1-3.1: Manufacturer: HelloWord
usb 1-3.1: SerialNumber: 262
usb 1-3.1: configuration #1 chosen from 1 choice
cdc_acm 1-3.1:1.0: This device cannot do calls on its own. It is not a modem.
cdc_acm 1-3.1:1.0: ttyACM0: USB ACM device
Thanks a lot.
AFAIK status -32 means "Broken pipe" (EPIPE). It means that there are problems with usb communication (protocol). For example usb-device doesn't answer correctly for usb-request, and sending some data that are not expected by host or sends not enough data. There may be also other reasons.
The first message tells that there are problems with "get device descriptor" and "set address" requests from host. Those are basic requests sending by host at the very beginning of enumeration process. You can't go further if those requests cannot be succesfully serviced by usb-device.
This error can be caused by clocking the on-chip USB device at the wrong frequency. Check your clock tree configuration. The frequency should be 48MHz. If it's slightly off, it's possible that enumeration would sometimes be successful and sometimes fail. If it's way off, enumeration will always fail. Various errors are possible including the ones you listed.
I have installed the XCP-NG server in one laptop and my system was not booting either due to this error: USB 3-1 device descriptor read/64, error 32
I tried a lot of things. Even disconnecting the USB ports.
Until I recalled that I have removed the default SR repository for Xen. So I went to check the /etc/fstab file
[root#xcpserver2 ~]# cat /etc/fstab
LABEL=root-jvgtod / ext3 defaults,noatime 1 1
LABEL=swap-jvgtod swap swap defaults 0 0
LABEL=logs-jvgtod /var/log ext3 defaults,noatime 0 2
/opt/xensource/packages/iso/XenCenter.iso /var/xen/xc-install iso9660 loop,ro 0 0
The default SR repository was trying to get the content of the last line. I tried to comment it and it worked!! :) I concluded that this error it also showing when there is a problem at the /etc/fstab file. I hope it helps!
So, my /etc/fstab file looks like this now and it solved the issue:
[root#xcpserver2 ~]# cat /etc/fstab
LABEL=root-jvgtod / ext3 defaults,noatime 1 1
LABEL=swap-jvgtod swap swap defaults 0 0
LABEL=logs-jvgtod /var/log ext3 defaults,noatime 0 2
#/opt/xensource/packages/iso/XenCenter.iso /var/xen/xc-install iso9660 loop,ro 0 0
Related
I'm try to disable my two USB keyboard on my linux system, the one can unbind long time until I unplug then plugin and the number lock light is off during this time. But the other one can not unbind long time, maybe after 5 seconds, it will reconnect again and the number lock light is on during this time, the other lights will flash once, the log shown below:
[505545.210490] usb 3-3.1: USB disconnect, device number 47
[505547.687005] usb 3-3.1: new low-speed USB device number 49 using xhci_hcd
[505547.984255] usb 3-3.1: New USB device found, idVendor=17ef, idProduct=6099
[505547.984258] usb 3-3.1: New USB device strings: Mfr=0, Product=1, SerialNumber=0
[505547.984260] usb 3-3.1: Product: Lenovo Traditional USB Keyboard
[505548.019948] input: Lenovo Traditional USB Keyboard as /devices/pci0000:00/0000:00:15.0/0000:03:00.0/usb3/3-3/3-3.1/3-3.1:1.0/input/input40
[505548.071999] hid-generic 0003:17EF:6099.002A: input,hidraw1: USB HID v1.10 Keyboard [Lenovo Traditional USB Keyboard] on usb-0000:03:00.0-3.1/input0
Below is my shell command to disable the keyboard:
echo "3-3.1" > /sys/bus/usb/drivers/usb/unbind
or
echo "0003:17EF:6099.002A" > /sys/bus/hid/drivers/hid-generic/unbind
What is the reason for this difference? Is have a way to disable the second keyboard?
Thank a lot
I have a usb mass storage, and today I insert into usb port, the usb can't be open, I using "dmesg" to see infomation
adan#adan-Latitude-D630:~$ dmesg | tail
[ 409.001220] composite sync not supported
[ 616.340074] usb 2-1: new high-speed USB device number 5 using ehci-pci
[ 617.392967] usb 2-1: New USB device found, idVendor=090c, idProduct=3000
[ 617.392979] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 617.392987] usb 2-1: Product: SM3255AA MEMORY BAR
[ 617.392994] usb 2-1: Manufacturer: Silicon Motion,Inc.
[ 617.393558] scsi5 : usb-storage 2-1:1.0
[ 618.393265] scsi 5:0:0:0: Direct-Access USB MEMORY BAR 1000 PQ: 0 ANSI: 0 CCS
[ 618.397967] sd 5:0:0:0: Attached scsi generic sg2 type 0
[ 618.399479] sd 5:0:0:0: [sdb] Attached SCSI removable disk
On windows, the usb mass storage was be detected as USB disk drive, can't open usb in file browser too.
what's wrong with my usb? how to fix it? thank you.
How to register an user space call back function with USB driver for mass storage devices in Linux?
I got follwing messages on to console when usb stick is attached.
usb 1-1: new high speed USB device using ehci_hcd and address 2
usb 1-1: Product: DataTraveler G2
usb 1-1: Manufacturer: Kingston
usb 1-1: SerialNumber: 0019E06B07F7A961877C02A9
usb 1-1: configuration #1 chosen from 1 choice
scsi0 : SCSI emulation for USB Mass Storage devices
scsi 0:0:0:0: Direct-Access Kingston DataTraveler G2 1.00 PQ: 0 ANSI: 2
SCSI device sda: 7818240 512-byte hdwr sectors (4003 MB)
sda: Write Protect is off
sda: assuming drive cache: write through
SCSI device sda: 7818240 512-byte hdwr sectors (4003 MB)
sda: Write Protect is off
sda: assuming drive cache: write through sda:sda1
sd 0:0:0:0: Attached scsi removable disk sda
sd 0:0:0:0: Attached scsi generic sg0 type 0
You could create an udev rule which executes a command when it is inserted. Basically you create a file containing a set of rules for matching, and the path to a program/script to run. It'll look something like this:
KERNEL=="sd?1", ATTRS{serial}=="0019E06B07F7A961877C02A9", RUN+="/path/to/script arg1 arg2 ... argN"
This will run /path/to/script with the arguments arg1 to argN when a device node named sd?1 is created, where ? is any character, with the serial number given in your data. You can get a lot of info from the udevinfo program to incorporate in the rule if you need better control over when it should fire. Such as if you want it to fire for all Kingston drives, for instance. Then you'd need to find the vendorID and maybe some more information unique to these drives.
I have several USB mass storage flash drives connected to a Ubuntu Linux computer (Ubuntu 10.04.1, kernel 2.6.32-25-386), and I need to tell them apart programatically (from bash if possible, but I'm not afraid of compiling either) - I need to find which block device corresponds to which physical device (e.g. /dev/sdb1 -> device in USB port 1; in my case, one device ~ one volume).
In other words, I know that I have three hardware devices plugged into USB ports; each of them shows up in the system as a USB mass storage device (as seen with lsusb), is created as a block device (/dev/sdb1) and automounted by UUID (/media/1234-5678).
USB device block device mountpoint
USB device in port 2.2 <-> /dev/sdb1 <-> /media/1234-5678
I'm not trying to find the relationship between block device and mountpoint; I'm trying to find the relationship between block device and USB device, is there a way?
Why? There will be some writes on the disks, with unpredictable time of completion. I need to give the operator some indication like "you can now remove the disk in port 2 (which is second from the left)". I have found which physical port corresponds to which port number on that specific machine, and finding block devices from mountpoints is simple; now I'm stuck mapping the logical USB ports to block devices.
I can see the disks with lsusb :
Bus 001 Device 058: ID 067b:2517 Prolific Technology, Inc. Mass Storage Device
Bus 001 Device 060: ID 067b:2517 Prolific Technology, Inc. Mass Storage Device
Bus 001 Device 061: ID 067b:2517 Prolific Technology, Inc. Mass Storage Device
and I can see them mounted (by their UUID):
/dev/sdb1 on /media/BC88-15C4 type vfat
/dev/sdc1 on /media/AE54-65AA type vfat
/dev/sdd1 on /media/58D2-FED1 type vfat
Now, all the drives are the same model from the same manufacturer, so I can't distinguish them by that, and I can't guarantee they'll be plugged in a particular order.
I have found /sys/bus/usb/devices (a list of USB devices), but it seems to be the same data that I get from lsusb - I don't see a mapping to disks there.
There's also /sys/block/sdb and /sys/block/sdb/sdb1 (the block device and its first partition; similarly for sdc and sdd), but again, I see no mapping to devices.
I'm not sure in which kernel version this was implemented, but the /sys/block/* entries are symlinks to the devices.
In other words, /sys/block/sdb symlinks to a different directory, and its name contains the USB device ID.
$ file /sys/block/sdb
/sys/block/sdb: symbolic link to `../devices/pci0000:00/0000:00:02.1/usb1/1-1/1-1.1/1-1.1:1.0/host31/target31:0:0/31:0:0:0/block/sdb'
USB version and port here---^^^^^
The 1-1.1 is the interesting part, denoting usb1-port 1.device 1. When plugged into a hub, another level is added: 1-2.3.1, denoting usb1-port 2.port 3.device 1.
Pseudocode:
get partition name # e.g. /dev/sdb1
get disk name # that would be /dev/sdb
get your basename # sdb
see where /sys/block/$your_basename points to # e.g. ../devices/blah/blah/1-2.1/blah
get the longest substring matching "\d-\d+(.\d+)*" # e.g. 1-2.1
that is the device id you want
/sys/bus/usb/devices/$device_id/ has all kinds of information about it
the ID corresponds to hardware USB ports
Working example script in bash.
I use the path:
/sys/bus/usb/drivers/usb-storage/4-1:1.0/host4/target4:0:0/4:0:0:0/block/sda
so you can see usb bus 4, port 1 is connected with a usb storage /dev/sda
Can't you use disk labels?
http://ubuntuforums.org/showthread.php?t=322973
Here is how I do it.
lsusb -v shows all the devices disks get an iserial number take note of them
ls -l /dev/disk | grep [iserial]
Everything in /dev/disk is a symlink so follow the symlink to see the device.
I have a temperature sensor, which is connected using an USB-I2C adapter (http://www.robot-electronics.co.uk/htm/usb_i2c_tech.htm)
I attached this device to my linux computer (suse10).
I typed dmesg and saw
usb 3-3: new full speed USB device using ohci_hcd and address 10
usb 3-3: new device found, idVendor=0403, idProduct=6001
usb 3-3: new device strings: Mfr=1, Product=2, SerialNumber=3
usb 3-3: Product: FT232R USB UART
usb 3-3: Manufacturer: FTDI
usb 3-3: SerialNumber: A7007K93
usb 3-3: configuration #1 chosen from 1 choice
ftdi_sio 3-3:1.0: FTDI USB Serial Device converter detected
drivers/usb/serial/ftdi_sio.c: Detected FT232BM
usb 3-3: FTDI USB Serial Device converter now attached to ttyUSB0
But I have no idea how to read the current temperature.
updated 1: Actually the I2C bus can attach up to 127 sensors. But I have no idea how to list the addresses of available sensors.
Can anybody give me some hints? Thanks in advance
Your adapter allows you to send I2C commands over a virtual serial port. A serial port has been created for you. You need to open it and send commands to it. The commands are specific to the device you are connected to. See the example in the link you provided to get an idea.
It is hard to give you correct instructions without a datasheet. Most probably your device will use one byte address and the read procedure is as follows:
[I2C_AD1] [Device I2C address + Read bit] [Device Address register] [Number of bytes to read]
0x55 0xXX 0x00 0x01
You need to send 4 bytes to the serial port. The first one instructs the USB to I2C converter to send a read command. The second one is the address of the device attached to the I2C bus. I2C devices use 7-bit addresses (0-127). Usually these are given with one bit shifted at the left. Therefore you need to scan these addresses (iterate from 0 to 127, shift left one bit, set bit0 to 1):
([0x00 - 0x7F] << 1) | 1
Since we don't have a datasheet I can't tell anything about the last two bytes. You could try to use dummy values. If a device is attached to the scanned I2C address, it should reply with a NACK to an attempt to read a non-existing register. Read commands sent to an I2C address that doesn't correspond to an actual device should be ignored.