I am trying to parse this text file. It would have been easy to parse into a table like at the end, if there was a patter.
And I'm new to Powershell, so not sure how to tackle this problem.
Any help is appreciated.
USB\ROOT_HUB20\4&361B340A&0
Name: USB Root Hub
Driver installed from C:\windows\INF\usbport.inf [ROOTHUB.Dev]. 2 file(s) used by driver:
C:\windows\system32\drivers\usbhub.sys
C:\windows\system32\drivers\usbd.sys
ACPI\PNP0C09\1
USB\ROOT_HUB20\4&361B340A&1
Name: USB Root Hub
Driver installed from C:\windows\INF\usbport.inf [ROOTHUB.Dev]. 2 file(s) used by driver:
C:\windows\system32\drivers\usbhub.sys
C:\windows\system32\drivers\usbd.sys
ACPI\PNP0C09\2
USB\ROOT_HUB20\4&361B340A&2
Driver installed from C:\windows\INF\cmbatt.inf [CmBatt_Inst]. 2 file(s) used by driver:
C:\windows\system32\DRIVERS\CmBatt.sys
C:\windows\system32\DRIVERS\battc.sys
ACPI\PNP0C0A\2
Name: Microsoft ACPI-Compliant Control Method Battery
Driver installed from C:\windows\INF\cmbatt.inf [CmBatt_Inst]. 2 file(s) used by driver:
C:\windows\system32\DRIVERS\CmBatt.sys
C:\windows\system32\DRIVERS\battc.sys
Output
HardwareID Name File(s)
---------- ---- -------
USB\ROOT_HUB20... USB Root Hub C:\windows\INF\usbport.inf
USB\ROOT_HUB2... USB Root Hub C:\windows\system32\drivers\usbhub.sys
USB\ROOT_HUB20.. USB Root Hub C:\windows\system32\drivers\usbd.sys
ACPI\PNP0C09\1 C:\windows\INF\machine.inf
ACPI\PNP0C0A\1 Microsoft AC... C:\windows\INF\cmbatt.inf
Microsoft AC... C:\windows\system32\DRIVERS\CmBatt.sys
RegEx can make fairly simple work of this. Import the file, join it together so that it's a single multiline string, then split it on lines that don't start with space. That gets you individual records. Then split those on new line characters, and parse each line depending on what's in it. Again, RegEx will help define each line is. This code will output an object for each section, with 4 properties, HardwareID, Name, Driver, and Files. The Files property is an array of files.
(Get-Content C:\Path\To\File.txt) -join "`r`n" -Split "(?m)^(?=\S)" |
Where{$_} |
ForEach{
Clear-Variable Files,Driver,Name,HardwareID
$Files = #()
$HardwareID = ($_ -split "`r`n")[0].trim()
Switch -regex ($_ -split "`r`n"){
"^\s+Name:" {$Name = ($_ -split ':',2)[-1].trim();Continue}
"^\s+.:\\" {$Files += $_.trim();continue}
"^\s+Driver" {$Driver = [RegEx]::Matches($_,"(?<=Driver installed from )(.+?)(?= \[)").value;continue}
}
[PSCustomObject]#{'HardwareID' = $HardwareID;'Name' = $Name; 'Driver' = $Driver; 'Files' = $Files}
}
So that will output something like:
HardwareID Name Driver Files
---------- ---- ------ -----
USB\ROOT_HUB20\4&361B340A&0 USB Root Hub C:\windows\INF\usbport.inf {C:\windows\system32\drivers\usbhub.sys, C:\windows\system32\drivers\usbd.sys}
ACPI\PNP0C09\1 {}
USB\ROOT_HUB20\4&361B340A&1 USB Root Hub C:\windows\INF\usbport.inf {C:\windows\system32\drivers\usbhub.sys, C:\windows\system32\drivers\usbd.sys}
ACPI\PNP0C09\2 {}
USB\ROOT_HUB20\4&361B340A&2 C:\windows\INF\cmbatt.inf {C:\windows\system32\DRIVERS\CmBatt.sys, C:\windows\system32\DRIVERS\battc.sys}
ACPI\PNP0C0A\2 Microsoft ACPI-Compliant Control Method Battery C:\windows\INF\cmbatt.inf {C:\windows\system32\DRIVERS\CmBatt.sys, C:\windows\system32\DRIVERS\battc.sys}
Edit: Ok, I'm going to assume that you didn't really try to modify what I had here since adding the Drivers to the list of other files should be really simple by changing $Driver = to $Files += just like the line above it to add that file to the array of files as well.Although, it looks like you want a line for each file, including the driver file, so maybe having an array for the files isn't best suited for you. What you could do is output an object for the driver file, and then an object for each of the supporting files, and you could get your version number for each on the fly as you make your objects. So you could replace the [PSCustomObject] line above with this:
[PSCustomObject]#{'HardwareID' = $HardwareID;'Name' = $Name; 'Files' = $Driver; 'FileVersion' = If(Test-Path $_.Trim()){[System.Diagnostics.FileVersionInfo]::GetVersionInfo($_.trim()).FileVersion}}
$Files | ForEach{ [PSCustomObject]#{'HardwareID' = $HardwareID;'Name' = $Name; 'Files' = $_; 'FileVersion' = If(Test-Path $_.Trim()){[System.Diagnostics.FileVersionInfo]::GetVersionInfo($_.trim()).FileVersion}Else{'File Not Found'}}}
This would output as:
HardwareID Name Files FileVersion
---------- ---- ----- -----------
USB\ROOT_HUB20\4&361B340A&0 USB Root Hub C:\windows\INF\usbport.inf
USB\ROOT_HUB20\4&361B340A&0 USB Root Hub C:\windows\system32\drivers\usbhub.sys 6.3.9600.17238 (winblue_gdr.140723-2018)
USB\ROOT_HUB20\4&361B340A&0 USB Root Hub C:\windows\system32\drivers\usbd.sys 6.3.9600.17195 (winblue_gdr.140530-1506)
ACPI\PNP0C09\1
USB\ROOT_HUB20\4&361B340A&1 USB Root Hub C:\windows\INF\usbport.inf
USB\ROOT_HUB20\4&361B340A&1 USB Root Hub C:\windows\system32\drivers\usbhub.sys 6.3.9600.17238 (winblue_gdr.140723-2018)
USB\ROOT_HUB20\4&361B340A&1 USB Root Hub C:\windows\system32\drivers\usbd.sys 6.3.9600.17195 (winblue_gdr.140530-1506)
ACPI\PNP0C09\2
USB\ROOT_HUB20\4&361B340A&2 C:\windows\INF\cmbatt.inf
USB\ROOT_HUB20\4&361B340A&2 C:\windows\system32\DRIVERS\CmBatt.sys 6.3.9600.16384 (winblue_rtm.130821-1623)
USB\ROOT_HUB20\4&361B340A&2 C:\windows\system32\DRIVERS\battc.sys 6.3.9600.16384 (winblue_rtm.130821-1623)
ACPI\PNP0C0A\2 Microsoft ACPI-Compliant Control Method Battery C:\windows\INF\cmbatt.inf
ACPI\PNP0C0A\2 Microsoft ACPI-Compliant Control Method Battery C:\windows\system32\DRIVERS\CmBatt.sys 6.3.9600.16384 (winblue_rtm.130821-1623)
ACPI\PNP0C0A\2 Microsoft ACPI-Compliant Control Method Battery C:\windows\system32\DRIVERS\battc.sys 6.3.9600.16384 (winblue_rtm.130821-1623)
Related
Thank you for watching this.
I'm having difficulties with my BBB on CAN communication like for months...
I'd be really pleased if you could give me just a little help!
I'm working on CAN protocol between BBB and another CAN device.
The another device is confirmed to be working alright with CAN.
I'm using my BBB with Cloud9 platform on windows laptop,
and on the another device, it's using CAN0.
I have set the 'config-pin' on BBB like below using CAN1, and I tried 'cansend' utility.
The bitratre value on the another device is also set to be equal.
config-pin p9.24 can
config-pin p9.26 can
ip link set can1 up type can bitrate
cansend can1 300#AC.AB.AD.AE.75.49.AD.D1
Yet it still seems like there is no CAN packets being sent or received.
(That receiving code is written in additional info. )
Plus, I tried to catch some signal with oscilloscope machine, but I couldn't get a thing at all.
Then, I modified some lines of uEnv.txt like below, located inside the boot folder of BBB.
###Additional custom capes
uboot_overlay_addr4=/lib/firmware/BB-CAN0-00A0.dtbo
uboot_overlay_addr5=/lib/firmware/BB-CAN1-00A0.dtbo
#uboot_overlay_addr6=/lib/firmware/<file6>.dtbo
#uboot_overlay_addr7=/lib/firmware/<file7>.dtbo
###
But CAN still does not work, and config-pin command after this uEnv.txt setting shows error like below
debian#beaglebone:/lib/firmware$ config-pin -q p9.24
ERROR: open() for /sys/devices/platform/ocp/ocp:P9_24_pinmux/state failed, No such file or directory
I truly suspect there might be something wrong with the driver or pinmux setting,
because the code did work well in other situations.
The same messages for the other overlayed pins. Actually any config-pin commands don't work on these pins. (And of course the CAN bus is still not working)
I'm currently using the latest AM3358 Debian 10.3 (2020-04-06) SD IoT image, and packages seems to be all updated well. The image is flashed and no SD card is in.
I really appreciate you read this. Thank you!
Additional Info:
CAN receive part code
#include <linux/can.h>
#include <linux/can/raw.h>
#include <net/if.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <errno.h>
#include <unistd.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <fcntl.h>
int InitCanInterface(const char *ifname){
int sock = socket(PF_CAN, SOCK_RAW, CAN_RAW);
fcntl(sock, F_SETFL, O_NONBLOCK);
if (sock == -1){
printf("Fail to create CAN socket for %s - %m \n", ifname);
return -1;
}
printf("Success to create CAN socket for %s\n", ifname);
struct ifreq ifr;
strncpy(ifr.ifr_name, ifname, IFNAMSIZ - 1);
int ret = ioctl(sock, SIOCGIFINDEX, &ifr);
if (ret == -1){
perror("Fail to get CAN interface index");
return -1;
}
printf("Success to get CAN interface index: %d\n", ifr.ifr_ifindex);
struct sockaddr_can addr;
addr.can_family = AF_CAN;
addr.can_ifindex = ifr.ifr_ifindex;
ret = bind(sock, (struct sockaddr*)&addr, sizeof(addr));
if (ret == -1){
perror("Fail to bind CAN socket -");
return -1;
}
printf("Success to bind CAN socket\n");
return sock;}
int TransmitCanFrame(const int sock, const uint32_t id, const uint8_t *data, const size_t data_len){
struct can_frame frame;
frame.can_id = id & 0x1ffffff;
frame.can_id |= (1<<31);
memcpy(frame.data, data, data_len);
frame.can_dlc = data_len;
int tx_bytes = write(sock, &frame, sizeof(frame));
if (tx_bytes == -1){
perror("Fail to transmit CAN frame -");
return -1;
}
printf("Success to transmit CAN frame - %d bytes is transmitted\n", tx_bytes);
return 0;
}
#define CAN_FRAME_MAX_LEN 8
int ReceiveCanFrame(const int sock){
struct can_frame frame;
int rx_bytes = read(sock, &frame, sizeof(frame));
if (rx_bytes < 0){
//perror("Fail to receive CAN frame -");
return -1;
}
else if (rx_bytes < (int)sizeof(struct can_frame)){
printf("Incomplete CAN frame is received - rx_bytes: %d/n", rx_bytes);
return -1;
}
else if (frame.can_dlc > CAN_FRAME_MAX_LEN){
printf("Invalid dlc: %u\n", frame.can_dlc);
return -1;
}
if (((frame.can_id >> 29) & 1) ==1) {
printf("Error frame is received\n");
}
else if (((frame.can_id >> 30) & 1) ==1) {
printf("RTR frame is received\n");
}
else {
if (((frame.can_id >> 31) & 1) == 0){
printf("11bit long std CAN frame is received\n");
printf("%#x\n",frame.can_id);
}
else {
printf("29bit long ext CAN frame is received\n");
printf("%#x\n",frame.can_id & 0x0001fffffff );
}
}
for (int ii=0; ii<8; ii++) {
printf("0x%X ", frame.data[ii]);
}
printf("\n");
printf("\n");
return 0;
}
int main(){
int sock = InitCanInterface("can0");
if (sock < 0 ){
return -1;
}
// uint8_t can_data[CAN_FRAME_MAX_LEN] = {};
while(1) {
//printf("hello\n");
//printf("%d",ReceiveCanFrame(sock));
//if(ReceiveCanFrame(sock) == 0)
//printf("No response\n");
ReceiveCanFrame(sock);
sleep(1);
}
return 0;
}
uname -a outputs
debian#beaglebone:/lib/firmware$ uname -a
Linux beaglebone 4.19.94-ti-r64 #1buster SMP PREEMPT Fri May 21 23:57:28 UTC 2021 armv7l GNU/Linux
debian#beaglebone:/lib/firmware$ sudo /opt/scripts/tools/version.sh
git:/opt/scripts/:[e8ae28ccc34a177e9435a0d24cdf8421e081c19a]
eeprom:[A335BNLT00C00620BBBK11BC]
model:[TI_AM335x_BeagleBone_Black]
dogtag:[BeagleBoard.org Debian Buster IoT Image 2020-04-06]
bootloader:[eMMC-(default)]:[/dev/mmcblk1]:[U-Boot SPL 2019.04-00002-g07d5700e21 (Mar 06 2020 - 11:24:55 -0600)]:[location: dd MBR]
bootloader:[eMMC-(default)]:[/dev/mmcblk1]:[U-Boot 2019.04-00002-g07d5700e21]:[location: dd MBR]
UBOOT: Booted Device-Tree:[am335x-boneblack-uboot-univ.dts]
UBOOT: Loaded Overlay:[AM335X-PRU-RPROC-4-19-TI-00A0]
UBOOT: Loaded Overlay:[BB-ADC-00A0]
UBOOT: Loaded Overlay:[BB-BONE-eMMC1-01-00A0]
UBOOT: Loaded Overlay:[BB-CAN0-00A0]
UBOOT: Loaded Overlay:[BB-CAN1-00A0]
UBOOT: Loaded Overlay:[BB-HDMI-TDA998x-00A0]
kernel:[4.19.94-ti-r64]
nodejs:[v10.24.0]
/boot/uEnv.txt Settings:
uboot_overlay_options:[enable_uboot_overlays=1]
uboot_overlay_options:[uboot_overlay_addr4=/lib/firmware/BB-CAN0-00A0.dtbo]
uboot_overlay_options:[uboot_overlay_addr5=/lib/firmware/BB-CAN1-00A0.dtbo]
uboot_overlay_options:[uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-19-TI-00A0.dtbo]
uboot_overlay_options:[enable_uboot_cape_universal=1]
pkg check: to individually upgrade run: [sudo apt install --only-upgrade <pkg>]
pkg:[bb-cape-overlays]:[4.14.20210416.0-0~buster+20210416]
pkg:[bb-customizations]:[1.20210708.0-0~buster+20210708]
pkg:[bb-usb-gadgets]:[1.20200504.0-0~buster+20200504]
pkg:[bb-wl18xx-firmware]:[1.20210520.0-0~buster+20210520]
pkg:[kmod]:[26-1]
pkg:[librobotcontrol]:[1.0.5-git20200715.0-0~buster+20200716]
pkg:[firmware-ti-connectivity]:[20190717-2rcnee1~buster+20200305]
groups:[debian : debian adm kmem dialout cdrom floppy audio dip video plugdev users systemd-journal bluetooth netdev i2c gpio pwm eqep remoteproc admin spi iio docker tisdk weston-launch xenomai cloud9ide]
cmdline:[console=ttyO0,115200n8 bone_capemgr.uboot_capemgr_enabled=1 root=/dev/mmcblk1p1 ro rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0 lpj=1990656 rng_core.default_quality=100 quiet]
dmesg | grep remote
[ 65.289088] remoteproc remoteproc0: wkup_m3 is available
[ 65.320630] remoteproc remoteproc0: powering up wkup_m3
[ 65.320664] remoteproc remoteproc0: Booting fw image am335x-pm-firmware.elf, size 217148
[ 65.320951] remoteproc remoteproc0: remote processor wkup_m3 is now up
[ 68.227786] remoteproc remoteproc1: 4a334000.pru is available
[ 68.241566] remoteproc remoteproc2: 4a338000.pru is available
dmesg | grep pru
[ 68.227786] remoteproc remoteproc1: 4a334000.pru is available
[ 68.227985] pru-rproc 4a334000.pru: PRU rproc node pru#4a334000 probed successfully
[ 68.241566] remoteproc remoteproc2: 4a338000.pru is available
[ 68.241750] pru-rproc 4a338000.pru: PRU rproc node pru#4a338000 probed successfully
dmesg | grep pinctrl-single
[ 0.943044] pinctrl-single 44e10800.pinmux: 142 pins, size 568
dmesg | grep gpio-of-helper
[ 0.956633] gpio-of-helper ocp:cape-universal: ready
lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
END
dmesg for CAN
debian#beaglebone:/lib/firmware$ dmesg | grep can
[ 1.205500] c_can_platform 481cc000.can: c_can_platform device registered (regs=3377e4b7, irq=42)
[ 1.206878] c_can_platform 481d0000.can: c_can_platform device registered (regs=292aef38, irq=43)
[ 1.422353] can: controller area network core (rev 20170425 abi 9)
[ 992.007971] c_can_platform 481d0000.can can1: setting BTR=2701 BRPE=0000
[ 992.016624] IPv6: ADDRCONF(NETDEV_UP): can1: link is not ready
[ 992.017512] IPv6: ADDRCONF(NETDEV_CHANGE): can1: link becomes ready
The full uEnv.txt
debian#beaglebone:/lib/firmware$ cat /boot/uEnv.txt
#Docs: http://elinux.org/Beagleboard:U-boot_partitioning_layout_2.0
uname_r=4.19.94-ti-r64
#uuid=
#dtb=
###U-Boot Overlays###
###Documentation: http://elinux.org/Beagleboard:BeagleBoneBlack_Debian#U-Boot_Overlays
###Master Enable
enable_uboot_overlays=1
###
###Overide capes with eeprom
#uboot_overlay_addr0=/lib/firmware/<file0>.dtbo
#uboot_overlay_addr1=/lib/firmware/<file1>.dtbo
#uboot_overlay_addr2=/lib/firmware/<file2>.dtbo
#uboot_overlay_addr3=/lib/firmware/<file3>.dtbo
###
###Additional custom capes
uboot_overlay_addr4=/lib/firmware/BB-CAN0-00A0.dtbo
uboot_overlay_addr5=/lib/firmware/BB-CAN1-00A0.dtbo
#uboot_overlay_addr6=/lib/firmware/<file6>.dtbo
#uboot_overlay_addr7=/lib/firmware/<file7>.dtbo
###
###Custom Cape
#dtb_overlay=/lib/firmware/<file8>.dtbo
###
###Disable auto loading of virtual capes (emmc/video/wireless/adc)
#disable_uboot_overlay_emmc=1
#disable_uboot_overlay_video=1
#disable_uboot_overlay_audio=1
#disable_uboot_overlay_wireless=1
#disable_uboot_overlay_adc=1
###
###PRUSS OPTIONS
###pru_rproc (4.14.x-ti kernel)
#uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-14-TI-00A0.dtbo
###pru_rproc (4.19.x-ti kernel)
uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-19-TI-00A0.dtbo
###pru_uio (4.14.x-ti, 4.19.x-ti & mainline/bone kernel)
#uboot_overlay_pru=/lib/firmware/AM335X-PRU-UIO-00A0.dtbo
###
###Cape Universal Enable
enable_uboot_cape_universal=1
###
###Debug: disable uboot autoload of Cape
#disable_uboot_overlay_addr0=1
#disable_uboot_overlay_addr1=1
#disable_uboot_overlay_addr2=1
#disable_uboot_overlay_addr3=1
###
###U-Boot fdt tweaks... (60000 = 384KB)
#uboot_fdt_buffer=0x60000
###U-Boot Overlays###
cmdline=coherent_pool=1M net.ifnames=0 lpj=1990656 rng_core.default_quality=100 quiet
#In the event of edid real failures, uncomment this next line:
#cmdline=coherent_pool=1M net.ifnames=0 lpj=1990656 rng_core.default_quality=100 quiet video=HDMI-A-1:1024x768#60e
##enable Generic eMMC Flasher:
##make sure, these tools are installed: dosfstools rsync
#cmdline=init=/opt/scripts/tools/eMMC/init-eMMC-flasher-v3.sh
Some help on can or socketCAN will be found here for the BBB or other family board:
https://www.beyondlogic.org/adding-can-to-the-beaglebone-black/
Also:
https://github.com/craigpeacock/CAN-Examples
These examples are a bit older and I have noticed that the Linux Distro on the BBB, if getting it from bbb.io/latest-images , is going through an overhaul.
For instance, I have noticed that the config-pin utility still works but that some of their overlays and DeviceTrees for the BBB peripherals are being sent into mainline, esp. for the BBAI.
When those examples do not help you configure the, and those examples are not mine but I figured they would help, socketCAN on Linux, please reply. I am working on a simple CAN interface from those examples and while using Linux is helpful, some things like the Device Trees are in a mode of change and I think this goes along w/ config-pin too.
For instance...
If you go to their forum at forum.beagleboard.org, you will see some people from GSOC working on examples from config-pin utilities to PRU cores which will be helpful for people getting into the shared memory, microcontroller game.
Here is the config-pin idea I found on their forum page:
https://forum.beagleboard.org/t/beagle-config-logs/30174
I have set up CAN on debian 10.3 (Buster) on beaglebone black.
I left uEnv.txt as default and issued these commands (as root) to enable CAN:
config-pin p9.24 can
config-pin p9.26 can
ip link set can1 up type can bitrate 1000000
candump can1
Once this is working, you can automate this setup using uEnv.txt and /etc/network/interfaces as descibed here - https://www.beyondlogic.org/adding-can-to-the-beaglebone-black/ and here - https://www.thomas-wedemeyer.de/beaglebone-canbus-python.html
If this doesnt work, I'd suggest ensuring there is no other software or updates installed that could be messing this up - try a fresh debian install on another SD card, and ensuring the hardware - the bus driver and wiring is ok.
I solved BBB CAN problem just by changing transceiver board into another one.
Don't use cjmcu-230 CAN transceiver board. I use the one from Waveshare. https://www.waveshare.com/sn65hvd230-can-board.htm
Both CAN transceiver board use same SN65HVD230 chip, but it seems that there is some ground pin circuit issue inside the cjmcu-230 board.
Hope you don't waste your time if you have this issue.
i'm a beginner.
i use a RPI3 and a buildroot build system and try to enable wireless.
I followed several links without success.
In particulary, i followed this link : https://delog.wordpress.com/2014/10/10/wireless-on-raspberry-pi-with-buildroot/
and verify my linux kernel wireless options are activated, but no results.
However, the options i used on the buildroot . config file seems to be good :
debian-host:/build/buildroot# egrep -i "wireless|wpa|80211" .config
# BR2_PACKAGE_WIRELESS_REGDB is not set
BR2_PACKAGE_WIRELESS_TOOLS=y
BR2_PACKAGE_WIRELESS_TOOLS_LIB=y
BR2_PACKAGE_WPA_SUPPLICANT=y
BR2_PACKAGE_WPA_SUPPLICANT_NL80211=y
BR2_PACKAGE_WPA_SUPPLICANT_AP_SUPPORT=y
BR2_PACKAGE_WPA_SUPPLICANT_WIFI_DISPLAY=y
# BR2_PACKAGE_WPA_SUPPLICANT_MESH_NETWORKING is not set
BR2_PACKAGE_WPA_SUPPLICANT_AUTOSCAN=y
BR2_PACKAGE_WPA_SUPPLICANT_EAP=y
BR2_PACKAGE_WPA_SUPPLICANT_HOTSPOT=y
BR2_PACKAGE_WPA_SUPPLICANT_DEBUG_SYSLOG=y
BR2_PACKAGE_WPA_SUPPLICANT_WPS=y
BR2_PACKAGE_WPA_SUPPLICANT_CLI=y
BR2_PACKAGE_WPA_SUPPLICANT_WPA_CLIENT_SO=y
BR2_PACKAGE_WPA_SUPPLICANT_PASSPHRASE=y
# BR2_PACKAGE_WPA_SUPPLICANT_DBUS_OLD is not set
# BR2_PACKAGE_WPA_SUPPLICANT_DBUS_NEW is not set
BR2_PACKAGE_WPAN_TOOLS=y
I installed a minibian an another rpi3, i noticed a firmware was used and i installed it by a :
apt-get install firmware-brcm80211
If the firmware is not installed, I noticed that iwlist wlan0 scan have empty results. On my RPI3-buildroot-system, after booting, lsmod show no modules.
I need to load manually by modprobe or by /etc/modules. So i load the same modules used on minibian, so i did (i loaded bluetooth mods also)
uname -a
Linux pi3 4.9.13-rt12-v7 #1 SMP Mon Mar 20 14:04:21 CET 2017 armv7l GNU/Linux
pwd
/lib/modules/4.9.13-rt12-v7/kernel/drivers
find . -name "*brcm*.ko"
./net/wireless/broadcom/brcm80211/brcmfmac/brcmfmac.ko
./net/wireless/broadcom/brcm80211/brcmutil/brcmutil.ko
modprobe 8192cu
modprobe brcmfmac
modprobe brcmutil
modprobe hci_uart
modprobe bnep
and the lsmod show :
lsmod
Module Size Used by Not tainted
8192cu 581125 0
hci_uart 19956 0
btbcm 7992 1 hci_uart
bnep 12051 0
bluetooth 364941 3 hci_uart,btbcm,bnep
brcmfmac 222136 0
brcmutil 9156 1 brcmfmac
cfg80211 543530 1 brcmfmac
rfkill 20944 2 bluetooth,cfg80211
ipv6 405794 18 [permanent]
but
iwlist wlan0 scan
wlan0 Interface doesn't support scanning.
I don't arrive to have the same result as my minibian distro with my apt-get ..
What is the way to retrieve the buildroot process to have the same result that on my minibian ?
I've forget something ?
Thanks for helping me.
When using make menuconfig, enable rpi-wifi-firmware under Target packages > Hardware handling > Firmware to include the firmware files.
For WiFi on the Raspberry Pi, you need to enable the following packages in your defconfig file :
BR2_PACKAGE_WPA_SUPPLICANT=y
BR2_PACKAGE_RPI_WIFI_FIRMWARE=y
If you want to reference any other things, I have an older buildroot external tree here for the Raspberry Pi.
Using DevCon utility, I ran this command to get the list of all of the drivers installed in the computer.
devcon.exe driverfiles * > drivers.txt
The output looks like this:
USB\ROOT_HUB20\4&361B340A&0
Name: USB Root Hub
Driver installed from C:\windows\INF\usbport.inf [ROOTHUB.Dev]. 2 file(s) used by driver:
C:\windows\system32\drivers\usbhub.sys
C:\windows\system32\drivers\usbd.sys
ACPI\PNP0C09\1
USB\ROOT_HUB20\4&361B340A&1
Name: USB Root Hub
Driver installed from C:\windows\INF\usbport.inf [ROOTHUB.Dev]. 2 file(s) used by driver:
C:\windows\system32\drivers\usbhub.sys
C:\windows\system32\drivers\usbd.sys
I then used PowerShell script to parse the file. Thanks to TheMadTechnician.
(Get-Content C:\Path\To\File.txt) -join "`r`n" -Split "(?m)^(?=\S)" |
Where{$_} |
ForEach{
Clear-Variable Files,Driver,Name,HardwareID
$Files = #()
$HardwareID = ($_ -split "`r`n")[0].trim()
Switch -regex ($_ -split "`r`n"){
"^\s+Name:" {$Name = ($_ -split ':',2)[-1].trim();Continue}
"^\s+.:\\" {$Files += $_.trim();continue}
"^\s+Driver" {$Driver = [RegEx]::Matches($_,"(?<=Driver installed from )(.+?)(?= \[)").value;continue}
}
[PSCustomObject]#{'HardwareID' = $HardwareID;'Name' = $Name; 'Files' = $Driver; 'FileVersion' = If(Test-Path $_.Trim()){[System.Diagnostics.FileVersionInfo]::GetVersionInfo($_.trim()).FileVersion}}
$Files | ForEach{ [PSCustomObject]#{'HardwareID' = $HardwareID;'Name' = $Name; 'Files' = $_; 'FileVersion' = If(Test-Path $_.Trim()){[System.Diagnostics.FileVersionInfo]::GetVersionInfo($_.trim()).FileVersion}Else{'File Not Found'}}}
Now, the output after running the script is:
HardwareID Name Files FileVersion
---------- ---- ----- -----------
USB\ROOT_HUB20\4&361B340A&0 USB Root Hub C:\windows\INF\usbport.inf
USB\ROOT_HUB20\4&361B340A&0 USB Root Hub C:\windows\system32\drivers\usbhub.sys 6.3.9600.17238 (winblue_gdr.140723-2018)
USB\ROOT_HUB20\4&361B340A&0 USB Root Hub C:\windows\system32\drivers\usbd.sys 6.3.9600.17195 (winblue_gdr.140530-1506)
ACPI\PNP0C09\1
USB\ROOT_HUB20\4&361B340A&1 USB Root Hub C:\windows\INF\usbport.inf
USB\ROOT_HUB20\4&361B340A&1 USB Root Hub C:\windows\system32\drivers\usbhub.sys 6.3.9600.17238 (winblue_gdr.140723-2018)
USB\ROOT_HUB20\4&361B340A&1 USB Root Hub C:\windows\system32\drivers\usbd.sys 6.3.9600.17195 (winblue_gdr.140530-1506)
THE PROBLEM
I would like to add an extra column with driver version.
How can I find the driver version and list it next to the name column? Thank you!
EDIT
The code below parses driver version from the INF file.
I am not experienced with PowerShell, so how can I used this bit of information and incorporate it with the above code to add an extra column and list driver version; preferably, next to Name column.
$pattern = 'DriverVer\s*=\s*(?:\d+/\d+/\d+,)?(.*)'
Select-String -Pattern $pattern -Path $path |
select -Expand Matches -First 1 |
% { $_.Groups[1].Value }
# $path = the INF file
Adding a new column is relatively simple. The columns are listed because they are properties of the object in the array. So right now we have object that are built like this (the driver line is similar, and then we pipe all remaining files into this, line breaks added for ease of reading):
[PSCustomObject]#{
'HardwareID' = $HardwareID
'Name' = $Name
'Files' = $_
'FileVersion' = If(Test-Path $_.Trim()){[System.Diagnostics.FileVersionInfo]::GetVersionInfo($_.trim()).FileVersion}Else{'File Not Found'}
}
From that we get the four columns 'HardwareID, 'Name', 'Files', and 'FileVersion'. If you want to add a column you can simply insert another property. In this case you want to add a new column next to Name that has the version of the driver for each item. We can simply re-purpose the line that currently outputs the driver file path (with missing version number) for each item:
[PSCustomObject]#{'HardwareID' = $HardwareID;'Name' = $Name; 'Files' = $Driver; 'FileVersion' = If(Test-Path $_.Trim()){[System.Diagnostics.FileVersionInfo]::GetVersionInfo($_.trim()).FileVersion}}
With that line we can just remove the bit in there that tries to list anything in the 'FileVersion' column, and add a new one in there for 'DriverVersion' using the code that you supplied (with some minor modifications). We're going to move the $Pattern = line to be the first line of the script, since we don't need to re-assign that for each iteration of the loop. Then we are going to assign the rest of your code to the new 'DriverVersion' property/column, and wrap it in a If($Driver){} statement, so that it doesn't throw errors for entries that don't have a driver listed. So that now looks like this:
[PSCustomObject]#{
'HardwareID' = $HardwareID
'Name' = $Name
'DriverVersion' = If($Driver){Select-String -Pattern $pattern -Path $driver | select -Expand Matches -First 1 |%{ $_.Groups[1].Value }}else{''}
'Files' = $Driver
'FileVersion' = '' }
Now, since we added that property to that line, we need to update the next line as well so that it includes that property as well (albeit with a blank value):
$Files | ForEach{ [PSCustomObject]#{'HardwareID' = $HardwareID;'Name' = $Name; 'DriverVersion'= ''; 'Files' = $_; 'FileVersion' = If(Test-Path $_.Trim()){[System.Diagnostics.FileVersionInfo]::GetVersionInfo($_.trim()).FileVersion}Else{'File Not Found'}}}
The updated code as a whole would look something like:
$pattern = 'DriverVer\s*=\s*(?:\d+/\d+/\d+,)?(.*)'
(Get-Content C:\Path\To\File.txt) -join "`r`n" -Split "(?m)^(?=\S)" |
Where{$_} |
ForEach{
Clear-Variable Files,Driver,Name,HardwareID,DriverVer -ea SilentlyContinue
$Files = #()
$HardwareID = ($_ -split "`r`n")[0].trim()
Switch -regex ($_ -split "`r`n"){
"^\s+Name:" {$Name = ($_ -split ':',2)[-1].trim();Continue}
"^\s+.:\\" {$Files += $_.trim();continue}
"^\s+Driver" {$Driver = [RegEx]::Matches($_,"(?<=Driver installed from )(.+?)(?= \[)").value;continue}
}
[PSCustomObject]#{
'HardwareID' = $HardwareID
'Name' = $Name
'DriverVersion' = If($Driver){Select-String -Pattern $pattern -Path $driver | select -Expand Matches -First 1 |%{ $_.Groups[1].Value }}else{''}
'Files' = $Driver
'FileVersion' = '' }
$Files | ForEach{ [PSCustomObject]#{'HardwareID' = $HardwareID;'Name' = $Name; 'DriverVersion'= ''; 'Files' = $_; 'FileVersion' = If(Test-Path $_.Trim()){[System.Diagnostics.FileVersionInfo]::GetVersionInfo($_.trim()).FileVersion}Else{'File Not Found'}}}
}|ft
This now outputs something along the lines of:
HardwareID Name DriverVersion Files FileVersion
---------- ---- ------------- ----- -----------
USB\ROOT_HUB20\4&361B340A&0 USB Root Hub 6.3.9600.17238 C:\windows\INF\usbport.inf
USB\ROOT_HUB20\4&361B340A&0 USB Root Hub C:\windows\system32\drivers\usbhub.sys 6.3.9600.17238 (winblue_gdr.140723-2018)
USB\ROOT_HUB20\4&361B340A&0 USB Root Hub C:\windows\system32\drivers\usbd.sys 6.3.9600.17195 (winblue_gdr.140530-1506)
ACPI\PNP0C09\1
USB\ROOT_HUB20\4&361B340A&1 USB Root Hub 6.3.9600.17238 C:\windows\INF\usbport.inf
USB\ROOT_HUB20\4&361B340A&1 USB Root Hub C:\windows\system32\drivers\usbhub.sys 6.3.9600.17238 (winblue_gdr.140723-2018)
USB\ROOT_HUB20\4&361B340A&1 USB Root Hub C:\windows\system32\drivers\usbd.sys 6.3.9600.17195 (winblue_gdr.140530-1506)
ACPI\PNP0C09\2
USB\ROOT_HUB20\4&361B340A&2 6.3.9600.16384 C:\windows\INF\cmbatt.inf
USB\ROOT_HUB20\4&361B340A&2 C:\windows\system32\DRIVERS\CmBatt.sys 6.3.9600.16384 (winblue_rtm.130821-1623)
USB\ROOT_HUB20\4&361B340A&2 C:\windows\system32\DRIVERS\battc.sys 6.3.9600.16384 (winblue_rtm.130821-1623)
ACPI\PNP0C0A\2 Microsoft ACPI-Compliant Control Method Battery 6.3.9600.16384 C:\windows\INF\cmbatt.inf
ACPI\PNP0C0A\2 Microsoft ACPI-Compliant Control Method Battery C:\windows\system32\DRIVERS\CmBatt.sys 6.3.9600.16384 (winblue_rtm.130821-1623)
ACPI\PNP0C0A\2 Microsoft ACPI-Compliant Control Method Battery C:\windows\system32\DRIVERS\battc.sys 6.3.9600.16384 (winblue_rtm.130821-1623)
I am working with a group who needs to access a MSSQL db from a linux host and in my searching found FreeTDS, which i am able to connect with FreeTDS but our programmer states that ODBC will require to configured with FreeTDS for their PHP code to work. With that being said, i have tried configuring both unixODBC and unixODBC_23 for the past day and have been unsuccesful in finding a config that works properly and I am also not able to get tracing working either. So, without further ado, here is my config
--- odbc.ini and odbc_23.ini ---
[TC]
Description = FreeTDS Connection
Driver = FreeTDS
Database = mydb
ServerName = 192.168.1.12
TDS_Version = 7.0
PORT = 3433
[Default]
Driver = /usr/local/freetds-0.91/lib/libtdsodbc.so
---odbcinst.ini and odbcinst_23.ini---
[FreeTDS]
Description = FreeTDS
Driver = /usr/local/freetds-0.91/lib/libtdsodbc.so
Trace = 1
TraceFile = /tmp/freetds.log
UsageCount = 1
When i try connecting via isql, here is what i receive.
root#host(~)# isql_23 -v TC myuser mydb
[S1000][unixODBC][FreeTDS][SQL Server]Unable to connect to data source
[01000][unixODBC][FreeTDS][SQL Server]Unknown host machine name.
[ISQL]ERROR: Could not SQLConnect
root#host(~)#
Any ideas would be greatly appreciated!
Try Server instead of ServerName?
Server = 192.168.1.12
Ok, so there was one additional change that i had to make in addition to changing "ServerName" to "Server" and that was I removed "Database = mydb" and moved it to the "Server" and now my file looks like so:
[TC]
Description = FreeTDS
Driver = FreeTDS
Server = 192.168.1.12\mydb
TDS_Version = 7.0
PORT = 3433
and now im connected with this command:
root#host(~)# isql_23 -v TC user password
+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+---------------------------------------+
SQL> ^C
root#host(~)#
I'm trying to get my receipt printer working on Debian Wheezy.
On being plugged into computer, my USB-serial Receipt Printer (epson tm-t88ii/ii compatible) tics question marks every few seconds, and does not respond to commands.
the output from the printer is:
˥ ?????????????????£???≡█
attempting to print to it by echo fails with error:
/dev/ttyUSB0: Permission denied
even as root.
attempting to open the cash drawer fails with error:
/dev/ttyUSB0: No such device
How do I get it to stop the tic and print?
Here's how I got it working:
after sending:
# echo "test" > /dev/ttyUSB0
returns Permission denied,
# dmesg | tail
returns:
[92780.658576] ftdi_sio 2-3:1.0: FTDI USB Serial Device converter detected
[92780.658624] usb 2-3: Detected FT232BM
[92780.658626] usb 2-3: Number of endpoints 2
[92780.658628] usb 2-3: Endpoint 1 MaxPacketSize 64
[92780.658630] usb 2-3: Endpoint 2 MaxPacketSize 64
[92780.658632] usb 2-3: Setting MaxPacketSize 64
[92780.664556] usb 2-3: FTDI USB Serial Device converter now attached to ttyUSB0
[92782.102904] usb 2-3: usbfs: interface 0 claimed by ftdi_sio while 'brltty' sets config #1
[92782.104874] ftdi_sio ttyUSB0: FTDI USB Serial Device converter now disconnected from ttyUSB0
[92782.104891] ftdi_sio 2-3:1.0: device disconnected
This indicates there is a conflict with package 'brltty', (braille device), which is installed by default.
# apt-get remove brltty
stops the tic
set baud with
# stty -F /dev/ttyUSB0 9600
try echo
$ echo "test" > /dev/ttyUSB0
it prints!
What about the cash drawer?
$ echo -e "\033\0160\0\031\372" >> /dev/ttyUSB0
it opens!
Problem solved. Unless you need a braille display as well.