Read VBus/USB data in Linux

983 views
Skip to first unread message

Eric Bosch

unread,
Feb 12, 2014, 4:22:37 PM2/12/14
to resol...@googlegroups.com
I have connected the VBus/USB adapter to a Linux device and with a Python script I want to read out the data.

When I read the USB port (/dev/ttyACM0) with a Python script nothing is read:

c = self.vbus_ser.read(1)

The port is opened as follows (portstr is /dev/ttyACM0):

self.vbus_ser = serial.Serial(port=None, baudrate=9600, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, bytesize=serial.EIGHTBITS, timeout=5.0)
   
    attempt = 1
 
    # configure the serial connections (the parameters differs on the device you are connecting to)
    try:
      self.vbus_ser.port = portstr 
     
      while (self.vbus_ser.isOpen() == False) and (attempt < 5):
        print "Attempt #" + str(attempt) + ", connecting to " + portstr
        self.vbus_ser.open()
        attempt = attempt + 1
     
      if True == self.vbus_ser.isOpen():
        print "Connected to " + self.vbus_ser.portstr
       
    except serial.SerialException as e:
      print e

Are there any VBus/USB drivers needed for Linux? What can be the problem here? Any help would be appreciated.

Regards ,
Eric

Andrew White

unread,
Feb 12, 2014, 4:34:37 PM2/12/14
to resol-vbus

Hi,  you don't need drivers,  you operating system has recognised the device and assigned a tty to it

Try  from shell

Cat /dev/ttyacm0 | hexdump

You should see the data stream

I did write a small c utility to decode vbus that might do what your looking for?  I updated recently with some more basic features
.

https://code.google.com/p/vbusdecode/

--
You received this message because you are subscribed to the Google Groups "Resol Vbus" group.
To unsubscribe from this group and stop receiving emails from it, send an email to resol-vbus+...@googlegroups.com.
To post to this group, send email to resol...@googlegroups.com.
Visit this group at http://groups.google.com/group/resol-vbus.
For more options, visit https://groups.google.com/groups/opt_out.

Eric Bosch

unread,
Feb 12, 2014, 5:17:13 PM2/12/14
to resol...@googlegroups.com
Hi Andy,

When I try cat /dev/ttyACM0 | hexdump from shell it doesn't result in any datastream. The result of this command is empty.

Any idea?

Op woensdag 12 februari 2014 22:34:37 UTC+1 schreef Andy:

Andrew White

unread,
Feb 12, 2014, 7:02:00 PM2/12/14
to resol-vbus
sounds like your not getting any data from the device.  what device is it, what usb cable/interface are you using etc. etc.

Eric Bosch

unread,
Feb 13, 2014, 3:24:47 AM2/13/14
to resol...@googlegroups.com
It's a ZEN Dt5 controller which as a Deltasol BS device connected to a VBus/USB adapter to the USB port of a RaspberryPI.

I have used the same script on a Windows 7 PC (with the drivers installed from Resol and connected via the USB port to the VBus/USB adapter) and on that PC I can read the data.

So it is not clear to me why it is not working on a Linux device.

Op donderdag 13 februari 2014 01:02:00 UTC+1 schreef Andy:

Andrew White

unread,
Feb 13, 2014, 3:33:45 AM2/13/14
to resol-vbus

Can you send the output of dmesg?   What distribution are you using for your pi?

I recall usb issues in some linux versions on pi,  I don't remember which ones though

Eric Bosch

unread,
Feb 13, 2014, 5:03:38 AM2/13/14
to resol...@googlegroups.com
I will send you the output and further information this evening, because I am not at home now

Op donderdag 13 februari 2014 09:33:45 UTC+1 schreef Andy:

Eric Bosch

unread,
Feb 13, 2014, 1:22:36 PM2/13/14
to resol...@googlegroups.com
Hi Andy

The distro installed on the raspberryPI:

PRETTY_NAME="Raspbian GNU/Linux 7 (wheezy)"
NAME="Raspbian GNU/Linux"
VERSION_ID="7"
VERSION="7 (wheezy)"
ID=raspbian
ID_LIKE=debian
ANSI_COLOR="1;31"
HOME_URL="
http://www.raspbian.org/"
SUPPORT_URL="
http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="
http://www.raspbian.org/RaspbianBugs"

Output of lsusb:

Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 004: ID 0bda:8176 Realtek Semiconductor Corp. RTL8188CUS 802.11n WLAN Adapter
Bus 001 Device 005: ID 1fef:2018

Device 005 on bus 001  is the Resol VBus/USB adapter.

Output of dmesg:

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Initializing cgroup subsys cpu
[    0.000000] Initializing cgroup subsys cpuacct
[    0.000000] Linux version 3.10.25+ (
dc4@dc4-arm-01) (gcc version 4.7.2 20120731 (prerelease) (crosstool-NG linaro-1.13.1+bzr2458 - Linaro GCC 2012.08) ) #622 PREEMPT Fri Jan 3 18:41:00 GMT 2014
[    0.000000] CPU: ARMv6-compatible processor [410fb767] revision 7 (ARMv7), cr=00c5387d
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT nonaliasing instruction cache
[    0.000000] Machine: BCM2708
[    0.000000] cma: CMA: reserved 16 MiB at 1b000000
[    0.000000] Memory policy: ECC disabled, Data cache writeback
[    0.000000] On node 0 totalpages: 114688
[    0.000000] free_area_init_node: node 0, pgdat c05cfd6c, node_mem_map c067d000
[    0.000000]   Normal zone: 896 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 114688 pages, LIFO batch:31
[    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[    0.000000] pcpu-alloc: [0] 0
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 113792
[    0.000000] Kernel command line: dma.dmachans=0x7f35 bcm2708_fb.fbwidth=656 bcm2708_fb.fbheight=416 bcm2708.boardrev=0xe bcm2708.serial=0xb447ec41 smsc95xx.macaddr=B8:27:EB:47:EC:41 sdhci-bcm2708.emmc_clock_freq=250000000 vc_mem.mem_base=0x1ec00000 vc_mem.mem_size=0x20000000  dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait ip=169.254.0.2
[    0.000000] PID hash table entries: 2048 (order: 1, 8192 bytes)
[    0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
[    0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
[    0.000000] Memory: 448MB = 448MB total
[    0.000000] Memory: 431652k/431652k available, 27100k reserved, 0K highmem
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
[    0.000000]     vmalloc : 0xdc800000 - 0xff000000   ( 552 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xdc000000   ( 448 MB)
[    0.000000]     modules : 0xbf000000 - 0xc0000000   (  16 MB)
[    0.000000]       .text : 0xc0008000 - 0xc05727b4   (5546 kB)
[    0.000000]       .init : 0xc0573000 - 0xc0597424   ( 146 kB)
[    0.000000]       .data : 0xc0598000 - 0xc05d0870   ( 227 kB)
[    0.000000]        .bss : 0xc05d0870 - 0xc067c3e0   ( 687 kB)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] Preemptible hierarchical RCU implementation.
[    0.000000] NR_IRQS:330
[    0.000000] sched_clock: 32 bits at 1000kHz, resolution 1000ns, wraps every 4294967ms
[    0.000000] Switching to timer-based delay loop
[    0.000000] Console: colour dummy device 80x30
[    0.000000] console [tty1] enabled
[    0.001185] Calibrating delay loop (skipped), value calculated using timer frequency.. 2.00 BogoMIPS (lpj=10000)
[    0.001252] pid_max: default: 32768 minimum: 301
[    0.001725] Mount-cache hash table entries: 512
[    0.002537] Initializing cgroup subsys memory
[    0.002648] Initializing cgroup subsys devices
[    0.002689] Initializing cgroup subsys freezer
[    0.002724] Initializing cgroup subsys blkio
[    0.002885] CPU: Testing write buffer coherency: ok
[    0.003364] Setting up static identity map for 0xc0406048 - 0xc04060a4
[    0.005194] devtmpfs: initialized
[    0.019647] NET: Registered protocol family 16
[    0.025645] DMA: preallocated 4096 KiB pool for atomic coherent allocations
[    0.026789] bcm2708.uart_clock = 0
[    0.028528] hw-breakpoint: found 6 breakpoint and 1 watchpoint registers.
[    0.028584] hw-breakpoint: maximum watchpoint size is 4 bytes.
[    0.028624] mailbox: Broadcom VideoCore Mailbox driver
[    0.028723] bcm2708_vcio: mailbox at f200b880
[    0.028829] bcm_power: Broadcom power driver
[    0.028871] bcm_power_open() -> 0
[    0.028900] bcm_power_request(0, 8)
[    0.529622] bcm_mailbox_read -> 00000080, 0
[    0.529666] bcm_power_request -> 0
[    0.529891] Serial: AMBA PL011 UART driver
[    0.530056] dev:f1: ttyAMA0 at MMIO 0x20201000 (irq = 83) is a PL011 rev3
[    0.873493] console [ttyAMA0] enabled
[    0.899483] bio: create slab <bio-0> at 0
[    0.904828] SCSI subsystem initialized
[    0.908805] usbcore: registered new interface driver usbfs
[    0.914524] usbcore: registered new interface driver hub
[    0.920099] usbcore: registered new device driver usb
[    0.926711] Switching to clocksource stc
[    0.931063] FS-Cache: Loaded
[    0.934237] CacheFiles: Loaded
[    0.950024] NET: Registered protocol family 2
[    0.955456] TCP established hash table entries: 4096 (order: 3, 32768 bytes)
[    0.962726] TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
[    0.969254] TCP: Hash tables configured (established 4096 bind 4096)
[    0.975729] TCP: reno registered
[    0.978989] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.984898] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.991637] NET: Registered protocol family 1
[    0.996569] RPC: Registered named UNIX socket transport module.
[    1.002633] RPC: Registered udp transport module.
[    1.007361] RPC: Registered tcp transport module.
[    1.012111] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    1.019487] bcm2708_dma: DMA manager at f2007000
[    1.024306] bcm2708_gpio: bcm2708_gpio_probe c05a5e50
[    1.029760] vc-mem: phys_addr:0x00000000 mem_base=0x1ec00000 mem_size:0x20000000(512 MiB)
[    1.039147] audit: initializing netlink socket (disabled)
[    1.044825] type=2000 audit(0.890:1): initialized
[    1.207088] VFS: Disk quotas dquot_6.5.2
[    1.211487] Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[    1.220335] FS-Cache: Netfs 'nfs' registered for caching
[    1.227079] NFS: Registering the id_resolver key type
[    1.232370] Key type id_resolver registered
[    1.236581] Key type id_legacy registered
[    1.241384] msgmni has been set to 875
[    1.247255] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252)
[    1.255114] io scheduler noop registered
[    1.259076] io scheduler deadline registered (default)
[    1.264669] io scheduler cfq registered
[    1.268812] bcm2708_fb_debugfs_init: could not create debugfs entry
[    1.276396] BCM2708FB: allocated DMA memory 5b400000
[    1.281554] BCM2708FB: allocated DMA channel 0 @ f2007000
[    1.304460] Console: switching to colour frame buffer device 82x26
[    1.314639] uart-pl011 dev:f1: no DMA platform data
[    1.321055] kgdb: Registered I/O driver kgdboc.
[    1.327612] vc-cma: Videocore CMA driver
[    1.332971] vc-cma: vc_cma_base      = 0x00000000
[    1.338989] vc-cma: vc_cma_size      = 0x00000000 (0 MiB)
[    1.345758] vc-cma: vc_cma_initial   = 0x00000000 (0 MiB)
[    1.361840] brd: module loaded
[    1.371472] loop: module loaded
[    1.376164] vchiq: vchiq_init_state: slot_zero = 0xdb000000, is_master = 0
[    1.385309] Loading iSCSI transport class v2.0-870.
[    1.392770] usbcore: registered new interface driver smsc95xx
[    1.400306] dwc_otg: version 3.00a 10-AUG-2012 (platform bus)
[    1.607625] Core Release: 2.80a
[    1.612126] Setting default values for core params
[    1.618180] Finished setting default values for core params
[    1.825089] Using Buffer DMA mode
[    1.829685] Periodic Transfer Interrupt Enhancement - disabled
[    1.836819] Multiprocessor Interrupt Enhancement - disabled
[    1.843689] OTG VER PARAM: 0, OTG VER FLAG: 0
[    1.849323] Dedicated Tx FIFOs mode
[    1.854642] dwc_otg: Microframe scheduler enabled
[    1.854879] dwc_otg bcm2708_usb: DWC OTG Controller
[    1.861168] dwc_otg bcm2708_usb: new USB bus registered, assigned bus number 1
[    1.869745] dwc_otg bcm2708_usb: irq 32, io mem 0x00000000
[    1.876569] Init: Port Power? op_state=1
[    1.881862] Init: Power Port (0)
[    1.886509] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[    1.894731] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    1.903375] usb usb1: Product: DWC OTG Controller
[    1.909453] usb usb1: Manufacturer: Linux 3.10.25+ dwc_otg_hcd
[    1.916684] usb usb1: SerialNumber: bcm2708_usb
[    1.923372] hub 1-0:1.0: USB hub found
[    1.928515] hub 1-0:1.0: 1 port detected
[    1.934159] dwc_otg: FIQ enabled
[    1.934179] dwc_otg: NAK holdoff enabled
[    1.934190] dwc_otg: FIQ split fix enabled
[    1.934210] Module dwc_common_port init
[    1.934648] usbcore: registered new interface driver usb-storage
[    1.942476] mousedev: PS/2 mouse device common for all mice
[    1.950016] bcm2835-cpufreq: min=700000 max=700000 cur=700000
[    1.957327] bcm2835-cpufreq: switching to governor powersave
[    1.964385] bcm2835-cpufreq: switching to governor powersave
[    1.971360] cpuidle: using governor ladder
[    1.976670] cpuidle: using governor menu
[    1.981864] sdhci: Secure Digital Host Controller Interface driver
[    1.989294] sdhci: Copyright(c) Pierre Ossman
[    1.994966] sdhci: Enable low-latency mode
[    2.040746] mmc0: SDHCI controller on BCM2708_Arasan [platform] using platform's DMA
[    2.051249] mmc0: BCM2708 SDHC host at 0x20300000 DMA 2 IRQ 77
[    2.058484] sdhci-pltfm: SDHCI platform and OF driver helper
[    2.065636] ledtrig-cpu: registered to indicate activity on CPUs
[    2.075229] hidraw: raw HID events driver (C) Jiri Kosina
[    2.089578] usbcore: registered new interface driver usbhid
[    2.096624] usbhid: USB HID core driver
[    2.106461] TCP: cubic registered
[    2.113227] Initializing XFRM netlink socket
[    2.120951] NET: Registered protocol family 17
[    2.126938] Key type dns_resolver registered
[    2.135897] Indeed it is in host mode hprt0 = 00021501
[    2.142898] VFP support v0.3: implementor 41 architecture 1 part 20 variant b rev 5
[    2.171518] registered taskstats version 1
[    2.181134] drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
[    2.199185] mmc0: new high speed SDHC card at address b368
[    2.221301] mmcblk0: mmc0:b368 USD   7.45 GiB
[    2.228632]  mmcblk0: p1 p2
[    2.360772] usb 1-1: new high-speed USB device number 2 using dwc_otg
[    2.368887] Indeed it is in host mode hprt0 = 00001101
[    2.571528] usb 1-1: New USB device found, idVendor=0424, idProduct=9512
[    2.579733] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[    2.589406] hub 1-1:1.0: USB hub found
[    2.594889] hub 1-1:1.0: 3 ports detected
[    2.881034] usb 1-1.1: new high-speed USB device number 3 using dwc_otg
[    3.001451] usb 1-1.1: New USB device found, idVendor=0424, idProduct=ec00
[    3.009801] usb 1-1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[    3.021563] smsc95xx v1.0.4
[    3.089423] smsc95xx 1-1.1:1.0 eth0: register 'smsc95xx' at usb-bcm2708_usb-1.1, smsc95xx USB 2.0 Ethernet, b8:27:eb:47:ec:41
[    3.180939] usb 1-1.2: new high-speed USB device number 4 using dwc_otg
[    3.258005] smsc95xx 1-1.1:1.0 eth0: hardware isn't capable of remote wakeup
[    3.303101] usb 1-1.2: New USB device found, idVendor=0bda, idProduct=8176
[    3.311663] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[    3.320581] usb 1-1.2: Product: 802.11n WLAN Adapter
[    3.327169] usb 1-1.2: Manufacturer: Realtek
[    3.332991] usb 1-1.2: SerialNumber: 00e04c000001
[    3.420985] usb 1-1.3: new full-speed USB device number 5 using dwc_otg
[    3.538317] usb 1-1.3: New USB device found, idVendor=1fef, idProduct=2018
[    3.546891] usb 1-1.3: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[   13.260748] Waiting up to 110 more seconds for network.
[   23.260744] Waiting up to 100 more seconds for network.
[   33.260748] Waiting up to 90 more seconds for network.
[   43.260742] Waiting up to 80 more seconds for network.
[   53.260745] Waiting up to 70 more seconds for network.
[   63.260745] Waiting up to 60 more seconds for network.
[   73.260748] Waiting up to 50 more seconds for network.
[   83.260744] Waiting up to 40 more seconds for network.
[   93.260743] Waiting up to 30 more seconds for network.
[  103.260744] Waiting up to 20 more seconds for network.
[  113.260743] Waiting up to 10 more seconds for network.
[  123.260745] Waiting up to 0 more seconds for network.
[  123.280795] IP-Config: Guessing netmask 255.255.0.0
[  123.287046] IP-Config: Complete:
[  123.291258]      device=eth0, hwaddr=b8:27:eb:47:ec:41, ipaddr=169.254.0.2, mask=255.255.0.0, gw=255.255.255.255
[  123.303350]      host=169.254.0.2, domain=, nis-domain=(none)
[  123.310152]      bootserver=255.255.255.255, rootserver=255.255.255.255, rootpath=
[  124.795723] EXT4-fs (mmcblk0p2): ext4_orphan_cleanup: deleting unreferenced inode 49691
[  124.806768] EXT4-fs (mmcblk0p2): ext4_orphan_cleanup: deleting unreferenced inode 41789
[  124.807026] EXT4-fs (mmcblk0p2): 2 orphan inodes deleted
[  124.813684] EXT4-fs (mmcblk0p2): recovery complete
[  124.876447] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
[  124.886972] VFS: Mounted root (ext4 filesystem) on device 179:2.
[  124.897881] devtmpfs: mounted
[  124.902635] Freeing unused kernel memory: 144K (c0573000 - c0597000)
[  126.316246] udevd[156]: starting version 175
[  127.971118] cdc_acm 1-1.3:1.0: ttyACM0: USB ACM device
[  128.715035] bcm2708-i2s bcm2708-i2s.0: Failed to create debugfs directory
[  129.563434] usbcore: registered new interface driver rtl8192cu
[  137.971427] usbcore: registered new interface driver cdc_acm
[  137.978817] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
[  140.619808] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[  141.078924] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[  146.541823] FAT-fs (mmcblk0p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
[  233.433848] Adding 102396k swap on /var/swap.  Priority:-1 extents:1 across:102396k SSFS


As you can see device 5 is mapped on /dev/ttyACM0:

Hopefully you can help me further

Regards,
Eric

Op donderdag 13 februari 2014 09:33:45 UTC+1 schreef Andy:

Can you send the output of dmesg?   What distribution are you using for your pi?

Eric Bosch

unread,
Feb 17, 2014, 3:25:08 PM2/17/14
to resol...@googlegroups.com
Andy,

I have sent you the output you asked for.

Did you read it already?

Regards,
Eric

Op donderdag 13 februari 2014 09:33:45 UTC+1 schreef Andy:

Can you send the output of dmesg?   What distribution are you using for your pi?

Reply all
Reply to author
Forward
0 new messages