You are not logged in.
Pages: 1
Topic closed
Recently I got a PC as a present, but it didnt have LPT or COM connectors, so I bought a PCI expansion card.
Linux drivers were included on the cd (source code for a module) but I'm having problems with compiling them.
first of all the card is recognized as such:
[guest@daimos LINUX_Driver]$ lspci
(...)
05:00.0 Serial controller: MosChip Semiconductor Technology Ltd. PCI 9865 Multi-I/O Controller
05:00.1 Serial controller: MosChip Semiconductor Technology Ltd. PCI 9865 Multi-I/O Controller
05:00.2 Parallel controller: MosChip Semiconductor Technology Ltd. PCI 9865 Multi-I/O Controller
so the system is able to detect it just fine
after I tried to make the module i got this:
rm -f *.mod.c *.o *.ko .*.cmd *.symvers
make -C /lib/modules/3.15.3-1-ARCH/build/ SUBDIRS=/home/guest/LINUX_Driver modules
make[1]: Entering directory '/usr/lib/modules/3.15.3-1-ARCH/build'
make[1]: Leaving directory '/usr/lib/modules/3.15.3-1-ARCH/build'
Makefile:27: recipe for target 'default' failed
said line #27 is in the "default" section of Makefile
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
default:
$(RM) *.mod.c *.o *.ko .*.cmd *.symvers
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
gcc -pthread ioctl.c -o ioctl
this got me mad and i just removed the line and saw some progress with my attempt at compiling since it ended without an error and a script named ioctl
after launching (user input in bold)
[guest@daimos LINUX_Driver]$ ./ioctl
Please input the port of MCS99xx. (ex. /dev/ttyF0):/dev/ttyF0
Can't open /dev/ttyF0
ttyF0 didn't exist obviously, so i made a list of files in /dev with and without the card, here's a diff of it
[guest@daimos LINUX_Driver]$ diff -y with without
autofs autofs
block block
bsg bsg
btrfs-control btrfs-control
bus bus
cdrom cdrom
char char
console console
core core
cpu cpu
cpu_dma_latency cpu_dma_latency
cuse cuse
disk disk
dri dri
fb0 fb0
fd fd
fd0 fd0
full full
fuse fuse
hidraw0 <
hidraw1 <
hidraw2 <
hpet hpet
hugepages hugepages
initctl initctl
input input
kmsg kmsg
log log
loop-control loop-control
mapper mapper
mcelog mcelog
mem mem
mqueue mqueue
net net
network_latency network_latency
network_throughput network_throughput
null null
> parport0
port port
ppp ppp
psaux <
ptmx ptmx
pts pts
random random
rtc rtc
rtc0 rtc0
sda sda
sda1 sda1
sda2 sda2
sdb <
shm shm
snapshot snapshot
snd snd
sr0 sr0
stderr stderr
stdin stdin
stdout stdout
tty tty
tty0 tty0
tty1 tty1
tty10 tty10
tty11 tty11
tty12 tty12
tty13 tty13
tty14 tty14
tty15 tty15
tty16 tty16
tty17 tty17
tty18 tty18
tty19 tty19
tty2 tty2
tty20 tty20
tty21 tty21
tty22 tty22
tty23 tty23
tty24 tty24
tty25 tty25
tty26 tty26
tty27 tty27
tty28 tty28
tty29 tty29
tty3 tty3
tty30 tty30
tty31 tty31
tty32 tty32
tty33 tty33
tty34 tty34
tty35 tty35
tty36 tty36
tty37 tty37
tty38 tty38
tty39 tty39
tty4 tty4
tty40 tty40
tty41 tty41
tty42 tty42
tty43 tty43
tty44 tty44
tty45 tty45
tty46 tty46
tty47 tty47
tty48 tty48
tty49 tty49
tty5 tty5
tty50 tty50
tty51 tty51
tty52 tty52
tty53 tty53
tty54 tty54
tty55 tty55
tty56 tty56
tty57 tty57
tty58 tty58
tty59 tty59
tty6 tty6
tty60 tty60
tty61 tty61
tty62 tty62
tty63 tty63
tty7 tty7
tty8 tty8
tty9 tty9
ttyS0 ttyS0
ttyS1 ttyS1
ttyS2 ttyS2
ttyS3 ttyS3
uhid uhid
uinput uinput
urandom urandom
vboxdrv vboxdrv
vboxdrvu vboxdrvu
vboxusb <
vcs vcs
vcs1 vcs1
vcs2 vcs2
vcs3 vcs3
vcs4 vcs4
vcs5 vcs5
vcs6 vcs6
vcsa vcsa
vcsa1 vcsa1
vcsa2 vcsa2
vcsa3 vcsa3
vcsa4 vcsa4
vcsa5 vcsa5
vcsa6 vcsa6
vfio vfio
vga_arbiter vga_arbiter
vhci vhci
vhost-net vhost-net
watchdog watchdog
watchdog0 watchdog0
zero zero
so on my next attempt I used hidraw0 since it seemed to be a good candidate:
[guest@daimos LINUX_Driver]$ ./ioctl
Please input the port of MCS99xx. (ex. /dev/ttyF0):/dev/hidraw0
Wrong input!!
i browsed the web some more and decided to create /dev/ttyF0 on my own as suggested here
[guest@daimos LINUX_Driver]$ mknod /dev/ttyF0 c 201 0
it didn't work again and I'm out of ideas at this point.
if anyone could drop a hint or look at the source I'd be grateful.
(the rest of the Makefile is obsolete due to depending on SysVinit to load the module)
i also found some patches but i have no idea how to apply them
Last edited by Robasiewicz (2014-09-05 11:53:02)
Offline
No suggestions yet, but you may find this of interest.
Edit: BTW, hidraw is not what you are looking for. HID is Human Interface Device. It is a higher level protocol used for mice, keyboards, joysticks, magnetic strip card readers, etc... I find it interesting that the drivers instantiated hidraw nodes. I am also curious as to why the parport mode went missing.
Last edited by ewaller (2014-07-26 20:51:20)
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way
Offline
thank you for your fast reply.
I'm familiar with the link you posted and will be trying it out tomorrow.
I think the paraport mystery may have something to do with what I found inside the readme file:
To build driver on kernels from v3.1.0 till latest:
----------------------------------------------------
Since the device ID 99XX is included (as built-in) with kernel versions
starts from v3.1.0 and above, the following procedure is required to
follow to detect MCS99XX devices.
a) Go to the path,
"/usr/src/linux-x.y.z/drivers/tty/serial" in v3.1.0
$ cd /usr/src/linux-x.y.z/drivers/tty/serial/
"/usr/src/linux-x.y.z/drivers/tty/serial/8250" from v3.3.0 to latest
$ cd /usr/src/linux-x.y.z/drivers/tty/serial/8250/
b) Open file "8250_pci.c".
- find for the macro PCI_DEVICE_ID_NETMOS_9901, PCI_DEVICE_ID_NETMOS_9912,
PCI_DEVICE_ID_NETMOS_9922, PCI_DEVICE_ID_NETMOS_9904,
PCI_DEVICE_ID_NETMOS_9900, It will be found in two places,
1) In the struct definition "serial_pci_tbl[]"
- Comment the below lines,
"
{ PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9912,
0xA000, 0x1000,
0, 0, pbn_b0_1_115200 },
{ PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9922,
0xA000, 0x1000,
0, 0, pbn_b0_1_115200 },
{ PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9904,
0xA000, 0x1000,
0, 0, pbn_b0_1_115200 },
{ PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9900,
0xA000, 0x1000,
0, 0, pbn_b0_1_115200 },
{ PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9900,
0xA000, 0x3002,
0, 0, pbn_NETMOS9900_2s_115200 },
"
2) In the routine "pci_netmos_init"
- No need do any action, as we already done (a).
c) Re-compile the Linux kernel.
I've looked for those files but failed to find them.
I found however a module named 8250_dw, which is supposed to be a serial module. as the description states:
Synopsys DesignWare 8250 serial port driver
Offline
If the instructions say that I suppose you can just blackist 8250_dw and test if anything changes. You might also try manually loading parport_serial if it doesn't get loaded automatically and see if things start working.
R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K
Offline
If the instructions say that I suppose you can just blackist 8250_dw and test if anything changes. You might also try manually loading parport_serial if it doesn't get loaded automatically and see if things start working.
8250_dw is not loaded at system startup so there's really no point in blacklisting it imho. loaded parport_serial without much success
i also tried some tinkering with the parport_pc module as suggested here and in the official manual i found in an old archive. Thought it would work since my card uses the same chipset
did the following:
[root@daimos]# lspci -v
(...)
05:00.2 Parallel controller: MosChip Semiconductor Technology Ltd. PCI 9865 Multi-I/O Controller (prog-if 03 [IEEE1284])
Subsystem: Device a000:2000
Flags: bus master, medium devsel, latency 32, IRQ 18
I/O ports at d200 [size=8]
I/O ports at d300 [size=8]
Memory at fa104000 (32-bit, non-prefetchable) [size=4K]
Memory at fa105000 (32-bit, non-prefetchable) [size=4K]
Capabilities: <access denied>
Kernel modules: parport_pc
[root@daimos]# modprobe parport_pc io=0xd200
[root@daimos]# modprobe parport_pc io=0xd200 irq=18
[root@daimos]# modprobe lp
and finally cups recognizes my LPT printer! and it even prints
also the device parport0 is back in /dev again
now i need to find out whether serial ports work
wonder if i could use a similar method
i also made a few attempts at compiling the driver (i was actually missing linux-headers) but all of them failed due to files missing, also patching the code didn't help much since some Husks of the code were rejected
EDIT:
Once i get serial ports running, I'll post the solution and mark as [SOLVED]
Last edited by Robasiewicz (2014-07-27 17:08:58)
Offline
You might want to do 'lspci -nn' so you can see the vendor id and product id of the card, then google for that and see if you can find some more tips on how to make things work.
Another thing that might help you is to look at the card itself and see which chips it has, with luck maybe you can find some name correspondence with a kernel driver.
R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K
Offline
You might want to do 'lspci -nn' so you can see the vendor id and product id of the card, then google for that and see if you can find some more tips on how to make things work.
Another thing that might help you is to look at the card itself and see which chips it has, with luck maybe you can find some name correspondence with a kernel driver.
I did as you suggested and did some research on the device 9710:9865 and blacklisted 8250_dw just in case
this allowed me to find a brand new sourcecode for the driver as mentioned here (post by burakkucat).
I did run into a few obstacles, but managed to compile the modems.
The biggest problem was the lack of some kernel files, namely:
sal.h
fpu.h
mipsregs.h
pal.h
mca.h
switch_to.h (the original file was named system.h but as I learned it got replaced in the newer kernels
So i went thru the trouble of recreating them manually with sources I found online
Doing all of these things ensured a successful compilation. As the Makefile based on the old init system i decided to manually copy freshly compiled modules based on this parts of Makefile:
MAJORVERSION=$(shell uname -r | cut -d '.' -f 1)
(...)
ifeq ($(MAJORVERSION),3)
MDIR=drivers/tty/serial/
(...)
endif
(...)
install:
cp mcs9865.ko mcs9865-isa.ko /lib/modules/$(shell uname -r)/kernel/$(MDIR)
the directory would be (taking in account my current kernel version and some changes previously made);
/usr/lib/modules/3.15.3-1-ARCH/kernel/drivers/tty/serial/
later I gziped the modules to follow suite of all other modules chilling out there, however:
[root@daimos ~]# modprobe mcs9865
modprobe: FATAL: Module mcs9865 not found.
[root@daimos ~]# modprobe mcs9865-isa
modprobe: FATAL: Module mcs9865-isa not found.
Both of the modules i tried to lad were the result of one compilation. the Makefile suggests that they're both needed
It makes me wonder if I used the correct path or are the modules not recognized by the kernel due to using files that been replaced/merged as in the case of system.h
I will be researching this issue. I just want some input on things I've done so far.
EDIT: I failed to mention that I tried to do the same trick I did with parport_pc (adjusting I/O and IRQ accodring to lspci -v output), but this time with parport_serial and it didn't work quite well.
EDIT2: stroked out because this post is full of lies. not deleting for possible future reference
Last edited by Robasiewicz (2014-08-31 14:57:27)
Offline
after searching the web i managed to find a brand new sourcecode for the driver as mentioned here (post by burakkucat).
this is the only version that did compile for me
and here's the trick part:
the readme file states:
To build driver on kernels from v2.6.34 till latest:
----------------------------------------------------
Since the device ID 9865 is included (as built-in) with kernel versions
starts from v2.6.34 and above, the following procedure is required to
follow to detect MCS9865 devices.
a) Go to the path,
(...)
"/usr/src/kernels/linux-x.y.z/drivers/tty/serial/8250" from v3.2.0 to latest
$ cd /usr/src/linux-x.y.z/drivers/tty/serial/8250/
b) Open file "8250_pci.c".
- find for the macro PCI_DEVICE_ID_NETMOS_9865. It will be found in two places,
1) In the struct definition "serial_pci_tbl[]"
- Comment the below lines,
"
{ PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9865,
0xA000, 0x1000,
0, 0, pbn_b0_1_115200 },
{ PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9865,
0xA000, 0x3004,
0, 0, pbn_b0_bt_4_115200 },
"
2) In the routine "pci_netmos_init"
- No need do any action, as we already done (a).
and the a) step is a terrible lie as the file does not exist
the thing that needs to be done is to download the kernel sourcecode, edit the mentioned file (that is to be found in the sourcecode), compile the kernel and reinstall it.
then we chceck the Makefile and we find this:
MAJORVERSION=$(shell uname -r | cut -d '.' -f 1)
(...)
ifeq ($(MAJORVERSION),3)
MDIR=drivers/tty/serial/
(...)
endif
(...)
install:
cp mcs9865.ko mcs9865-isa.ko /lib/modules/$(shell uname -r)/kernel/$(MDIR)
depmod -A
chmod +x mcs9865
cp mcs9865 /etc/init.d/
ifeq ($(DEBIAN_DISTRO), $(DEBIAN_VERSION_FILE))
ln -s /etc/init.d/mcs9865 /etc/rcS.d/S99mcs9865 || true
else
ln -s /etc/init.d/mcs9865 /etc/rc3.d/S99mcs9865 || true
ln -s /etc/init.d/mcs9865 /etc/rc5.d/S99mcs9865 || true
endif
modprobe mcs9865
modprobe mcs9865-isa
since /lib is a symlink to /usr/lib i needed to copy the files to:
/usr/lib/modules/3.15.3-1-ARCH/kernel/drivers/tty/serial/
plus the Makefile still refers to SysVinit, so the install part is mostly out of date
[root@daimos ~]# depmod -A
[root@daimos ~]#cat /etc/modules-load.d/moschip.conf
mcs9865
mcs9865-isa
after the reboot I had new friends in /dev:
[guest@daimos ~]$ ls /dev/ | grep ttyD
ttyD0
ttyD1
all according to the manual I referred to earlier
now a quick look at my pci devices:
[guest@daimos ~]$ lspci -v
(...)
05:00.0 Serial controller: MosChip Semiconductor Technology Ltd. PCI 9865 Multi-I/O Controller (prog-if 02 [16550])
Subsystem: Device a000:1000
Flags: bus master, medium devsel, latency 32, IRQ 20
I/O ports at d000 [size=8]
Memory at fa100000 (32-bit, non-prefetchable) [size=4K]
Memory at fa101000 (32-bit, non-prefetchable) [size=4K]
Capabilities: <access denied>
Kernel driver in use: mcs9865-serial
Kernel modules: parport_pc
05:00.1 Serial controller: MosChip Semiconductor Technology Ltd. PCI 9865 Multi-I/O Controller (prog-if 02 [16550])
Subsystem: Device a000:1000
Flags: bus master, medium devsel, latency 32, IRQ 19
I/O ports at d100 [size=8]
Memory at fa102000 (32-bit, non-prefetchable) [size=4K]
Memory at fa103000 (32-bit, non-prefetchable) [size=4K]
Capabilities: <access denied>
Kernel driver in use: mcs9865-serial
Kernel modules: parport_pc
(...)
as you can see the driver in use is now mcs9865-serial instead of serial
now to figure out which port corresponds to which controller:
[guest@daimos ~]$ setserial -a /dev/ttyD0
/dev/ttyD0, Line 0, UART: 16550A, Port: 0xd000, IRQ: 20
Baud_base: 115200, close_delay: 50, divisor: 0
closing_wait: 3000
Flags: spd_normal skip_test
[guest@daimos ~]$ setserial -a /dev/ttyD1
/dev/ttyD1, Line 1, UART: 16550A, Port: 0xd100, IRQ: 19
Baud_base: 115200, close_delay: 50, divisor: 0
closing_wait: 3000
Flags: spd_normal skip_test
as the kernel modules load and I have new devices in /dev I can only mark the thread as [SOLVED]
now I need to figure out how to make my virtual machines use the ports and/or make them run with Wine
Offline
I know this topic is a bit old but I figured I'd weigh in anyway since this is the most recent post on the topic that I've found and I recently had to figure this out myself. Note, I'm not an arch user(Debian) but this should work anyway. ™
Once I had the driver (https://www.asix.com.tw/FrootAttach/dri … rce.tar.gz) compiled and installed, I opted against patching and recompiling my kernel in favor of manually binding the driver to the device. Which I then automated using udev. No patching/compiling kernel source necessary...
Here's my udev rule for doing it. I'm targeting the serial portion of the card(as opposed to isa), so obviously modify if necessary...
ACTION=="add", ATTR{vendor}=="0x9710", ATTR{device}=="0x9865", RUN+="/bin/bash -c 'echo $kernel > /sys/bus/pci/drivers/serial/unbind; echo $kernel > /sys/bus/pci/drivers/mcs9865-serial/bind'"
now I need to figure out how to make my virtual machines use the ports and/or make them run with Wine
In the case of wine, It's as easy as:
ln -s /dev/ttyD0 ~/.wine/dosdevices/com1
Last edited by iohzrd (2019-01-19 07:51:20)
Offline
A bit old is an understatement. Please do not necrobump.
Closing.
Offline
Thanks for sharing, however as this topic is old and already marked as [SOLVED] I'm closing it here.
https://wiki.archlinux.org/index.php/Co … bumping%22
Closing.
Offline
Pages: 1
Topic closed