Linux cdc-acm-driver

Manavendra Nath Manav mnm.kernel at gmail.com
Thu Mar 1 08:57:26 EST 2012


Hi Stefan

On Thu, Mar 1, 2012 at 5:48 PM, Manavendra Nath Manav
<mnm.kernel at gmail.com> wrote:
> On Thu, Mar 1, 2012 at 3:18 PM, Manavendra Nath Manav
> <mnm.kernel at gmail.com> wrote:
>> On Thu, Mar 1, 2012 at 1:57 PM, Stefan Dreyer
>> <stefan.dreyer at ddnetservice.net> wrote:
>>> Hi,
>>>
>>> allthough the answer is offtopic for cdc-acm-driver, i will answer, because
>>> maybe it helps other people in future.
>>
>>> I can tell you exactly, what is going on. If the scanner switches to
>>> ProductId=0720 (0c2e:0720) the scanner is working in Serial-Mode. If you
>>> want the scanner let work as serial device, you have to use the driver
>>> metro-usb. The manufacturer has this driver, but that one is outdatet and
>>> doesn't compile on actual Linux kernel.
>>> I found an actual driver, which compiles even with kernel 3.2
>>> <https://gitorious.org/other/metro-usb/commits/master>
>>
>> Thanks a lot for the prompt reply, this should adequately solve my
>> problem. I am able to download the driver source and compile. However,
>> I have run into a trivial module format error.
>>
>> [root at pe1800xs serial]# modinfo metro-usb.ko
>> filename:       metro-usb.ko
>> description:    Metrologic Instruments Inc. - USB-POS driver
>> author:         Aleksey Babahin <tamerlan311 at gmail.com>
>> author:         Philip Nicastro
>> license:        GPL
>> srcversion:     AF4C7DDE2804EBB1578A05F
>> alias:          usb:v0C2Ep0710d*dc*dsc*dp*ic*isc*ip*
>> alias:          usb:v0C2Ep0720d*dc*dsc*dp*ic*isc*ip*
>> depends:        usbserial
>> vermagic:       2.6.35.6-45.fc14.i686 SMP mod_unload modversions 686
>> parm:           debug:Print debug info (bool 1=on, 0=off) (bool)
>> parm:           vendor:User specified vendor ID (ushort) (ushort)
>> parm:           product:User specified product ID (ushort) (ushort)
>>
>> [root at pe1800xs serial]# modprobe -f -v metro-usb
>> insmod /lib/modules/2.6.35.6-45.fc14.i686/kernel/drivers/usb/serial/metro-usb.ko
>> FATAL: Error inserting metro_usb
>> (/lib/modules/2.6.35.6-45.fc14.i686/kernel/drivers/usb/serial/metro-usb.ko):
>> Invalid module format
>>
>> [root at pe1800xs serial]# uname -a
>> Linux pe1800xs 2.6.35.6-45.fc14.i686 #1 SMP Mon Oct 18 23:56:17 UTC
>> 2010 i686 i686 i386 GNU/Linux
>>
>> [root at pe1800xs serial]# dmesg
>> [84119.755750] metro_usb: version magic '2.6.35.6-45.fc14.i686 SMP
>> mod_unload modversions 686 ' should be '2.6.35.6-45.fc14.i686 SMP
>> mod_unload 686 '
>>
>> I am running Fedora14 with "Force module loading option disabled". How
>> can I turn it ON without recompiling the kernel. Or, since I have the
>> souce files of the driver (attached), how can I modify the metro-usb.c
>> file to provide suitable "module version".
>>
>
> I am able to load the metro-usb.ko module now and the scanner works
> perfectly.  I opened the serial console using
> bash# serial /dev/ttyUSB0 9600
> and can see the 1D and 2D scanned barcodes. Thanks :)
>
> [89073.533413] metro-usb 7-1:1.0: Metrologic USB to serial converter.
> converter detected
> [89073.533489] usb 7-1: Metrologic USB to serial converter. converter
> now attached to ttyUSB0
>
> The workaround I did to remove "invalid module format" error is that I
> modified the vermagic.h file.
>
> [root at pe1800xs e518816]# diff
> /usr/src/kernels/2.6.35.6-45.fc14.i686/include/linux/vermagic.h.old
> /usr/src/kernels/2.6.35.6-45.fc14.i686/include/linux/vermagic.h.new
> 32,33c32
> <       MODULE_VERMAGIC_MODULE_UNLOAD MODULE_VERMAGIC_MODVERSIONS       \
> <       MODULE_ARCH_VERMAGIC
> ---
>>       MODULE_VERMAGIC_MODULE_UNLOAD MODULE_ARCH_VERMAGIC
>
> Is this the correct way to resolve the error, although it works for
> me? I am sure there would be other better ways to resolve vermagic
> conflict errors.
>

The Metrologic scanner is working perfectly in bi-directional serial
mode. But when I configure it as USB HID Keyboard mode as shown in the
link and keyboard layout as US-English, I am not getting any data from
Scanner. I have opened a terminal and scanned multiple barcodes but no
output on screen.

[root at pe1800xs e518816]# dmesg
[98498.945783] input: Honeywell Scanning and Mobility Honeywell
Scanning and Mobility Scanner as
/devices/pci0000:00/0000:00:1d.1/usb7/7-2/7-2:1.0/input/input20
[98498.945850] generic-usb 0003:0C2E:0200.0011: input,hidraw2: USB HID
v1.11 Keyboard [Honeywell Scanning and Mobility Honeywell Scanning and
Mobility Scanner] on usb-0000:00:1d.1-2/input0

[root at pe1800xs e518816]# lsusb -v
Bus 007 Device 020: ID 0c2e:0200 Metro Metrologic Scanner
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0         8
  idVendor           0x0c2e Metro
  idProduct          0x0200 Metrologic Scanner
  bcdDevice           58.88
  iManufacturer           1 Honeywell Scanning and Mobility
  iProduct                2 Honeywell Scanning and Mobility Scanner
  iSerial                 0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           34
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          3 HID Keyboard
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              450mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      1 Boot Interface Subclass
      bInterfaceProtocol      1 Keyboard
      iInterface              0
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.11
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      63
         Report Descriptors:
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0008  1x 8 bytes
        bInterval              10
Device Status:     0x0000
  (Bus Powered)

[root at pe1800xs e518816]# cat /proc/bus/usb/devices
T:  Bus=07 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 20 Spd=1.5 MxCh= 0
D:  Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
P:  Vendor=0c2e ProdID=0200 Rev=58.88
S:  Manufacturer=Honeywell Scanning and Mobility
S:  Product=Honeywell Scanning and Mobility Scanner
C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=450mA
I:* If#= 0 Alt= 0 #EPs= 1 Cls=03(HID  ) Sub=01 Prot=01 Driver=usbhid
E:  Ad=81(I) Atr=03(Int.) MxPS=   8 Ivl=10ms

Can you help me in getting data from Scanner in USB HID Keyboard
Emulation mode as this would reduce the burden of using an extra
driver and the application program can read directly from the
emulation keyboard instead of listening to serial device.

Thanks & Regards,
Manavendra Nath Manav



More information about the Kernelnewbies mailing list