MCPcopy Create free account
hub / github.com/Hamlib/Hamlib / win32_serial_close

Function win32_serial_close

lib/termios.c:731–813  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

729----------------------------------------------------------*/
730
731int win32_serial_close(int fd)
732{
733 struct termios_list *index;
734 /* char message[80]; */
735
736 ENTER("serial_close");
737
738 if (!first_tl || !first_tl->hComm)
739 {
740 report("gotit!");
741 return (0);
742 }
743
744 index = win32_serial_find_port(fd);
745
746 if (!index)
747 {
748 LEAVE("serial_close");
749 return -1;
750 }
751
752 /* WaitForSingleObject( index->wol.hEvent, INFINITE ); */
753 /*
754 if ( index->hComm != INVALID_HANDLE_VALUE )
755 {
756 if ( !SetCommMask( index->hComm, EV_RXCHAR ) )
757 {
758 YACK();
759 report( "eventLoop hung\n" );
760 }
761 CloseHandle( index->hComm );
762 }
763 else
764 {
765 SNPRINTF( message, sizeof(message), sizeof(message), "serial_ close(): Invalid Port Reference for %s\n",
766 index->filename );
767 report( message );
768 }
769 */
770 if (index->next && index->prev)
771 {
772 index->next->prev = index->prev;
773 index->prev->next = index->next;
774 }
775 else if (index->prev)
776 {
777 index->prev->next = NULL;
778 }
779 else if (index->next)
780 {
781 index->next->prev = NULL;
782 first_tl = index->next;
783 }
784 else
785 {
786 first_tl = NULL;
787 }
788

Callers 1

win32_serial_openFunction · 0.85

Calls 1

win32_serial_find_portFunction · 0.85

Tested by

no test coverage detected