Tiny Core Base > TCB Q&A Forum

Problem locking serial device

(1/4) > >>

wolf_core:
Hi, I have connected an RS485 to USB converter to TC 3.7.1 + usb-serial- 2.6.33.3-tynycore.tcz  and it was recognised as ttyUSB0, but when i run a daemon ( aurora ) that use /dev/ttyUSB0 i have an error.


--- Code: ---tc@box :/mnt/sda1/aurora$ ./aurora -a 2 /dev/ttyUSB0
tc@box :/mnt/sda1/aurora$ Problem locking serial device, can't open lock file: /var/lock/LCK..ttyUSB0 for write.
--- End code ---

then i try


--- Code: ---tc@box :/mnt/sda1/aurora$ sudo ./aurora -a 2 /dev/ttyUSB0
tc@box :/mnt/sda1/aurora$ Problem locking serial device, can't write lock file for write: /var/lock/LCK..ttyUSB0.
No such file or directory.
--- End code ---

but a LCK..ttyUSB0 file was created in the directory  /var/lock/ with inside a PID identifier.

Can you help me.   Thanks in advance Luca

PS How i can save the output of console to file, i try with  xxxxxx > file.txt but I have only a empty file.txt

Rich:
Hi wolf_core
I think it is complaining because a lock file already exists. Delete it and try again.

--- Quote ---PS How i can save the output of console to file, i try with  xxxxxx > file.txt but I have only a empty file.txt
--- End quote ---
I take it by xxxxx you mean the aurora command in this case. See if this works:

--- Code: ---sudo ./aurora -a 2 /dev/ttyUSB0 &> file.txt
--- End code ---
Based on the error messages, I think you are supposed to use sudo.

wolf_core:
Hi Rich, i have restarted tiny core and there are no files in /var/lock then I launch


--- Code: ---tc@box : dmesg  | grep usb
tc@box : Kernel command line: initrd=/boot/tinycore.gz waitusb=5:UUID="786D-025A" tce=UUID="786D-025A" quiet BOOT_IMAGE=/boot/bzImage
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
usbcore: registered new interface driver usb-storage
usbcore: registered new interface driver ums-alauda
usbcore: registered new interface driver ums-cypress
usbcore: registered new interface driver ums-freecom
usbcore: registered new interface driver ums-isd200
usbcore: registered new interface driver ums-jumpshot
usbcore: registered new interface driver ums-karma
usbcore: registered new interface driver ums-onetouch
usbcore: registered new interface driver ums-sddr09
usbcore: registered new interface driver ums-sddr55
usbcore: registered new interface driver ums-usbat
usbcore: registered new interface driver berry_charge
usbcore: registered new interface driver appletouch
usbcore: registered new interface driver bcm5974
usbcore: registered new interface driver hiddev
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
usb 1-1: new low speed USB device using ohci_hcd and address 2
input: LITEON Technology USB Multimedia Keyboard as /devices/pci0000:00/0000:00:0f.4/usb1/1-1/1-1:1.0/input/input2
generic-usb 0003:046D:C312.0001: input: USB HID v1.10 Keyboard [LITEON Technology USB Multimedia Keyboard] on usb-0000:00:0f.4-1/input0
usb 1-2: new low speed USB device using ohci_hcd and address 3
input: Logitech USB-PS/2 Optical Mouse as /devices/pci0000:00/0000:00:0f.4/usb1/1-2/1-2:1.0/input/input3
generic-usb 0003:046D:C03E.0002: input: USB HID v1.10 Mouse [Logitech USB-PS/2 Optical Mouse] on usb-0000:00:0f.4-2/input0
usb 2-2: new full speed USB device using ohci_hcd and address 2
scsi0 : usb-storage 2-2:1.0
usb 2-1: new full speed USB device using ohci_hcd and address 3
usbcore: registered new interface driver usbserial
usbcore: registered new interface driver usbserial_generic
usbserial: USB Serial Driver core
usb 2-1: pl2303 converter now attached to ttyUSB0
usbcore: registered new interface driver pl2303

--- End code ---

the adapter RS485 to USB (pl2303) was recognised and ttyUSB0 was created and seems OK


--- Code: ---tc@box :/mnt/sda1/aurora$ sudo ./aurora -a 2 /dev/ttyUSB0
tc@box :/mnt/sda1/aurora$ 20120710-23:31:06: aurora: Problem locking serial device, can't write lock file: /var/lock/LCK..ttyUSB0.
No such file or directory

--- End code ---

same error :-( , and if I disconnect the adapter the error don't change

Thanks Luca

Rich:
Hi wolf_core
I decided to take a look at the source code to see if I could figure out what the program is complaining about. I noticed
that the author was misusing the  errno  variable. Open the file called main.c and find the phrase:

--- Code: ---|| errno_save != 0
--- End code ---
Remove all three instances of that phrase, not he whole line, just that exact phrase. Recompile the program and
see if it behaves any better.

wolf_core:
Ty Rich, your patch seems correcting the problem  ;D . Now I try to connect the adapter to RS485 port of  Photovoltaic inverter and I hope i can read the data.

Thanks a lot Luca

Navigation

[0] Message Index

[#] Next page

Go to full version